LogSistemas01 Posted May 15, 2020 Share Posted May 15, 2020 Hello people, would I like to put an image of Fontawesome in the column of my grid? I managed to do it by putting in SQL: <i class = "far fa-edit"> </i> It worked, but it doesn't make much sense to have this information in SQL. I was wondering if there is another way? If it is possible to put a button too, then on that button I would put fontawesome. I searched the demos and didn't find it, I saw only one case with an image where canvas is used. If there is an easier way it would be good to know. And also if it is possible to make the HandPoint mouse cursor appear in the column with the image. Thank you guys! Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 15, 2020 Share Posted May 15, 2020 Hello, 1 hour ago, LogSistemas01 said: If it is possible to put a button too, then on that button I would put fontawesome. \FMSoft\Framework\uniGUI\Demos\Desktop\Grid - ActionColumn ? Quote Link to comment Share on other sites More sharing options...
Abaksoft Posted May 16, 2020 Share Posted May 16, 2020 11 hours ago, LogSistemas01 said: it worked, but it doesn't make much sense to have this information in SQL. Thank you guys! You can use OnGetText property (DataSet Field) : 1. For a Persistent Field in this case "Etat" : procedure TFraDemandes.MyDataSetEtatGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin if DisplayText then begin // Demandé if Sender.AsVariant = NULL then Text:= '<i class="fas fa-smile fa-2x " style=color:orange; ></i>' // Proposé else if Sender.AsInteger = 1 then Text:= '<i class="fas fa-smile fa-2x " style=color:green; ></i>' // Absent else if Sender.AsInteger = 2 then Text:= '<i class="fas fa-smile fa-2x " style=color:black; ></i>' // Traité else if Sender.AsInteger = 3 then Text:= '<i class="fas fa-smile fa-2x " style=color:grey; ></i>'; end; end; 2. On an Optional Field (not existing in the DataBase) like column Edit and Trash : You can Add theese two Fields on your SQL query : txtSQL:='Select TPL.IDPlaning, .......' + _____________________________ '0 As Editer, 0 As Trash' + _____________________________ ' From TPLANINGS TPL ' + ' Join ....'; with the same technic : procedure TFraDemandes.MyDataSetTrashGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin if DisplayText then Text:='<i class="fas fa-trash"></i>'; end; Quote Link to comment Share on other sites More sharing options...
x11 Posted May 17, 2020 Share Posted May 17, 2020 i use Calculated string field + onCalcFields event http://forums.unigui.com/index.php?/topic/14264-остается-место-после-скрытия-иконок-у-tunitreeview/&do=findComment&comment=77178 Quote Link to comment Share on other sites More sharing options...
LogSistemas01 Posted May 18, 2020 Author Share Posted May 18, 2020 On 5/15/2020 at 7:57 PM, Sherzod said: Hello, \FMSoft\Framework\uniGUI\Demos\Desktop\Grid - ActionColumn ? Yes!!! Thanks! Quote Link to comment Share on other sites More sharing options...
LogSistemas01 Posted May 18, 2020 Author Share Posted May 18, 2020 On 5/16/2020 at 5:31 AM, Abaksoft said: You can use OnGetText property (DataSet Field) : 1. For a Persistent Field in this case "Etat" : procedure TFraDemandes.MyDataSetEtatGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin if DisplayText then begin // Demandé if Sender.AsVariant = NULL then Text:= '<i class="fas fa-smile fa-2x " style=color:orange; ></i>' // Proposé else if Sender.AsInteger = 1 then Text:= '<i class="fas fa-smile fa-2x " style=color:green; ></i>' // Absent else if Sender.AsInteger = 2 then Text:= '<i class="fas fa-smile fa-2x " style=color:black; ></i>' // Traité else if Sender.AsInteger = 3 then Text:= '<i class="fas fa-smile fa-2x " style=color:grey; ></i>'; end; end; 2. On an Optional Field (not existing in the DataBase) like column Edit and Trash : You can Add theese two Fields on your SQL query : txtSQL:='Select TPL.IDPlaning, .......' + _____________________________ '0 As Editer, 0 As Trash' + _____________________________ ' From TPLANINGS TPL ' + ' Join ....'; with the same technic : procedure TFraDemandes.MyDataSetTrashGetText(Sender: TField; var Text: string; DisplayText: Boolean); begin if DisplayText then Text:='<i class="fas fa-trash"></i>'; end; Ah, I know this possibility, I used it only once, thanks for reminding me! Quote Link to comment Share on other sites More sharing options...
LogSistemas01 Posted May 18, 2020 Author Share Posted May 18, 2020 On 5/17/2020 at 9:09 AM, x11 said: i use Calculated string field + onCalcFields event http://forums.unigui.com/index.php?/topic/14264-остается-место-после-скрытия-иконок-у-tunitreeview/&do=findComment&comment=77178 Thanks!! Good possibility! 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.