Jump to content

How to change cell in a row based on the different cell in the same row?


sysjames

Recommended Posts

I have a TUmiDBTreeGrid that has 5 columns.  If column 4 has a boolean value that is true, I wish to change the font of column 1 to strike-through font.  How would this be coded in the  OnDrawColumn event?

 

Thanks in advance.

Link to comment
Share on other sites

9 minutes ago, sysjames said:

I have a TUmiDBTreeGrid that has 5 columns.  If column 4 has a boolean value that is true, I wish to change the font of column 1 to strike-through font.  How would this be coded in the  OnDrawColumn event?

Hello,

You can try this code:

procedure TMainForm.UniDBTreeGrid1DrawColumnCell(Sender: TObject; ACol,
  ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin
  if (ACol=YourColNumber) and (YourDataSet.FieldByName(YourFieldName).AsString = YourValue) then //asBoolean...
    Attribs.Style.Style := 'text-decoration: line-through'
  else
    Attribs.Style.Style := '';

end;

 

Link to comment
Share on other sites

Thank you Sherzod.  Works well.  The only problem now is that my check boxes are very faint (washed out) and I can't tell why.  The rest of the row looks great, and the text associated with the boolean field (Yes and No) look great, but the checkboxes themselves are almost not visible.  They are there, just very faint.  I've looked at examples on line and can't see why mine are like this.  Any ideas?

Link to comment
Share on other sites

3 minutes ago, sysjames said:

Works well.  The only problem now is that my check boxes are very faint (washed out) and I can't tell why.  The rest of the row looks great, and the text associated with the boolean field (Yes and No) look great, but the checkboxes themselves are almost not visible.  They are there, just very faint.  I've looked at examples on line and can't see why mine are like this.  Any ideas?

Do you have a test case to see what you are saying?

Link to comment
Share on other sites

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...