enix Posted June 28, 2011 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 Quote
Administrators Farshad Mohajeri Posted June 28, 2011 Administrators Posted June 28, 2011 You can set it for each cell but not for the whole row. Quote
JasonReid Posted June 30, 2011 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 Quote
Semper Posted September 20, 2012 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? Quote
zilav Posted September 20, 2012 Posted September 20, 2012 Use CSS background style or <img> HTML tag. Quote
Semper Posted September 20, 2012 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 Quote
JasonReid Posted September 21, 2012 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 Quote
Semper Posted September 21, 2012 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! Quote
yuricruzz Posted January 27, 2015 Posted January 27, 2015 como inserir um comando nestas imagens Quote
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.