Jump to content

UniDBGrid, image + text in one cell


Rav

Recommended Posts

  • 1 year later...

i have kind of the same question. I need text and Image in one UniDBGrid cell. As well if possible a way to custom draw the cell including cell borders. In the demo i can change background color and Font color. I am using 1.0.0.1407 right now.

 

Best Regards

Link to comment
Share on other sites

  • 1 year later...

Hi,

I am doing some research on different products (uniGui, IntraWeb, ...) to migrate my desktop application into a web application.

In my desktop application, I use ListViews a lot (mainly because I need to show an image + text side by side in the grid) and really missed it in uniGUI. 

So my question: how to show image (png, ico, bmp - doesn't matter) + text in one TUniDBGrid cell?

Link to comment
Share on other sites

Thanks. Finally, I solved this puzzle, here is the solution:
 

procedure TUniForm.CountryGetText(Sender: TField; var Text: string;   DisplayText: Boolean); 
begin
    Text :=  '<img height="16", width="16", src="images\'
    + DataModule.FDQuery.FieldByName('Country').AsString
    + '.png" /> '
    + DataModule.FDQuery.FieldByName('Country').AsString;
end;

procedure TUniForm.UniDBGridDrawColumnCell(Sender: TObject; ACol,   
	ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs); 
begin   
    if Column.FieldName = 'Country' then     
        Column.Field.OnGetText := CountryGetText; 
end;

 

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...