MarcoRu Posted March 21, 2013 Share Posted March 21, 2013 Hi all, I'm trying to draw images in a column, depending the value of a cell. I don't have a client dataset, but a uniDBGrid, a datasource and a TAdoquery. I want reproduce something as shown in attached pictures (see column 'Stato'). Is possible to do do something similar with Unigui? Link to comment Share on other sites More sharing options...
JasonReid Posted March 21, 2013 Share Posted March 21, 2013 Here you go Please read the whole thread . Link to comment Share on other sites More sharing options...
MarcoRu Posted March 21, 2013 Author Share Posted March 21, 2013 Thanks!!! I'll try it!!! Link to comment Share on other sites More sharing options...
MarcoRu Posted March 26, 2013 Author Share Posted March 26, 2013 I read the post, but I can't do it. I don't have a ClientDataset. I have a UniDbGrid, a DataSource and a AdoQuery. There are other ways to do this? I'm trying with onDrawColumnCell but I can't. Link to comment Share on other sites More sharing options...
MarcoRu Posted March 26, 2013 Author Share Posted March 26, 2013 Resolved with help of Jason Reid. Many thaks!! Link to comment Share on other sites More sharing options...
misc Posted March 6, 2014 Share Posted March 6, 2014 Resolved with help of Jason Reid. Many thaks!! Hello Marco, can you post your code here? I have the same requirement. Link to comment Share on other sites More sharing options...
chefdackel Posted March 7, 2014 Share Posted March 7, 2014 Hello Marco, can you post your code here? I have the same requirement. 1. add a calculated field of type string and f.e. size 80. If you have a field "aktiv" with type integer name the new field "calc_aktiv" or what you like. 2. In the OnGetText event of this new field manage the HTML-output for the image: procedure TDataModule1.Query_KontaktListcalc_aktivGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin with sender.Dataset do begin case fieldbyname('aktiv').value of 0: text:= '<img width=16 height=16 src="/images/res_red.bmp"/>'; 1: text:= '<img width=16 height=16 src="/images/res_green.bmp"/>'; end; end; end; 3. Add a column to your grid with the field "calc_aktiv". Link to comment Share on other sites More sharing options...
adragan Posted March 10, 2014 Share Posted March 10, 2014 It works also with OnCalcFields. You can also add png formated pictures. 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