enix Posted June 28, 2011 Share Posted June 28, 2011 Hi, How to set font attributes for whole row instead of particular cells ? OnDrawColumnCell event allows check value of field in current drawing column. Is possible to get value from another column of the same row ? reg. Piotrek Pawlak Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted June 28, 2011 Administrators Share Posted June 28, 2011 You can set it for each cell but not for the whole row. Link to comment Share on other sites More sharing options...
JasonReid Posted June 30, 2011 Share Posted June 30, 2011 OnDrawColumnCell event allows check value of field in current drawing column. Is possible to get value from another column of the same row ? If you're using a data-aware TDataset descendent, just read the value from the dataset. Here I'm using the status field to set the background color for all cells in a row. procedure TfMain.UniDBGrid1DrawColumnCell(Sender: TObject; ACol, ARow: Integer; var Value: string; Column: TUniDBGridColumn; Attribs: TUniCellAttribs); begin If DataModule1.ISSUES_Tissue_status.AsString = 'Closed' then attribs.Color := clRed; end; so if the issue is closed, the row is red. Just be aware , the more you do this, the more it impacts performance. example 2: This will change the row font : procedure TfMain.UniDBGrid1DrawColumnCell(Sender: TObject; ACol, ARow: Integer; var Value: string; Column: TUniDBGridColumn; Attribs: TUniCellAttribs); begin If DataModule1.ISSUES_Tissue_status.AsString = 'Researching' then attribs.Font.Color := clRed; end; 1 Link to comment Share on other sites More sharing options...
Semper Posted September 20, 2012 Share Posted September 20, 2012 I looked at the thumbnails and see that it is possible to draw pictures in the cells. How is it done? Link to comment Share on other sites More sharing options...
zilav Posted September 20, 2012 Share Posted September 20, 2012 Use CSS background style or <img> HTML tag. Link to comment Share on other sites More sharing options...
Semper Posted September 20, 2012 Share Posted September 20, 2012 Use CSS background style or <img> HTML tag. Thanks,But I am a Delphi programmer and I am not familiar with javascript Is it possible any sample? Regards Link to comment Share on other sites More sharing options...
JasonReid Posted September 21, 2012 Share Posted September 21, 2012 Thanks, But I am a Delphi programmer and I am not familiar with javascript Is it possible any sample? Regards here you go, hope this helps. I have a calculated field in my dataset called ISSUES_TImageIcon. I just set the text for that to a valid HTML tag and the browser knows how to render it in the grid. procedure TDataModule1.ISSUES_TCalcFields(DataSet: TDataSet); Var aStatus : String; begin aStatus := Uppercase(ISSUES_TISSUE_STATUS.Value); If aStatus = 'CLOSED' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/tick.bmp"/>' Else if aStatus = 'RESEARCHING' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/research.bmp"/>' Else if aStatus = 'REPORTED' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/reported.bmp"/>' Else if aStatus = 'CAN CLOSE' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/flag_green.bmp"/>' Else ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/open.bmp"/>' ; end; 1 1 Link to comment Share on other sites More sharing options...
Semper Posted September 21, 2012 Share Posted September 21, 2012 here you go, hope this helps. I have a calculated field in my dataset called ISSUES_TImageIcon. I just set the text for that to a valid HTML tag and the browser knows how to render it in the grid. procedure TDataModule1.ISSUES_TCalcFields(DataSet: TDataSet); Var aStatus : String; begin aStatus := Uppercase(ISSUES_TISSUE_STATUS.Value); If aStatus = 'CLOSED' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/tick.bmp"/>' Else if aStatus = 'RESEARCHING' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/research.bmp"/>' Else if aStatus = 'REPORTED' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/reported.bmp"/>' Else if aStatus = 'CAN CLOSE' then ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/flag_green.bmp"/>' Else ISSUES_TImageIcon.Value := '<img width=16 height=16 src="images/open.bmp"/>' ; end; Thanks a lot! I am happy! Link to comment Share on other sites More sharing options...
yuricruzz Posted January 27, 2015 Share Posted January 27, 2015 como inserir um comando nestas imagens Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now