nickosl50 Posted March 25, 2018 Share Posted March 25, 2018 I would like to ask how we can display data in a UniDbGrid with a different font color depending on the value of data. e.g We have a grid that displays transactions of a customer and we want to to display the rows that have negative amount values in red color. Thank you very much Nick Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 25, 2018 Share Posted March 25, 2018 Hi, You can see our demo examples Are you still using the trial edition? Quote Link to comment Share on other sites More sharing options...
nickosl50 Posted March 25, 2018 Author Share Posted March 25, 2018 Hi, You can see our demo examples Are you still using the trial edition? I looked at mdemo but I could not find an example for this issue. I only saw an example for custom cell color. Yes I am still using trial edition because I have a look at Unigui part-time . I want to check out some things and most probably will move to full edition . Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 25, 2018 Share Posted March 25, 2018 UniDBGrid1 -> OnDrawColumnCell Attribs.Color - row (cell) BackgroundColor Attribs.Font.Color - font Color procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol, ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs); begin if UniDBGrid1.DataSource.DataSet.FieldByName('progress').AsInteger=100 then //for rows begin Attribs.Font.Style:=[fsbold]; Attribs.Font.Color:=clWhite; //font color Attribs.Color:=clGreen; //background color end; end; http://forums.unigui.com/index.php?/topic/5851-how-to-change-the-row-font-color-unidbgrid/ ... ... Quote Link to comment Share on other sites More sharing options...
JDDEV Posted October 1, 2019 Share Posted October 1, 2019 Hi, When i add this line after : Attribs.Style.Padding:='5px'; The Attribs.Font et Attribs.Color properties are not enabled !! Is it a bug ? Thanks Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 1, 2019 Share Posted October 1, 2019 11 minutes ago, JDDEV said: When i add this line after : Attribs.Style.Padding:='5px'; The Attribs.Font et Attribs.Color properties are not enabled !! Is it a bug ? Hi, Can you please make a simple testcase for check? Quote Link to comment Share on other sites More sharing options...
JDDEV Posted October 1, 2019 Share Posted October 1, 2019 I do the testcase with the GridCellStyle demo project. procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol, ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs); begin if ACol = 1 then begin //Attribs.Style.Cls:= 'myShadowStyle'; // style is defined in file "files/mycss.css" //Attribs.Style.Style := 'border: 5px solid green; font: red' // define a style directly Attribs.Font.Color:=clYellow; Attribs.Font.Style:=[fsItalic]; Attribs.Color:=clRed; Attribs.Style.Padding := '5px'; end else if ACol = 2 then Attribs.Style.Padding := '0px'; // force image to fit in the cell end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.