MarcoRu Posted March 21, 2013 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? Quote
JasonReid Posted March 21, 2013 Posted March 21, 2013 Here you go Please read the whole thread . Quote
MarcoRu Posted March 26, 2013 Author 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. Quote
MarcoRu Posted March 26, 2013 Author Posted March 26, 2013 Resolved with help of Jason Reid. Many thaks!! Quote
misc Posted March 6, 2014 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. Quote
chefdackel Posted March 7, 2014 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". Quote
adragan Posted March 10, 2014 Posted March 10, 2014 It works also with OnCalcFields. You can also add png formated pictures. 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.