Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 27 Apr 2024, 13:36

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 24 Jul 2023, 10:21 
Offline

Joined: 18 Jan 2022, 11:00
Posts: 3
hi, i want to use cellbutton in grid column.
but i need to show button only when fieldname has a value and for other values button must hide and cell shown as normal without button. how can i do it?
i test to set button enable but empty space of button is remained on cell


Attachments:
CellButton.jpg
CellButton.jpg [ 4.81 KiB | Viewed 1363 times ]
Top
 Profile  
 
PostPosted: 26 Jul 2023, 16:45 
Offline

Joined: 08 May 2014, 18:06
Posts: 663
Hello

Unfortunately, there is no way in the grid to show or not show a certain CellButton depending on the values of the record.

You can achieve a similar effect through LaObjects by specifying the desired LaControlTemplate in the TColumnEh.OnGetLaControlTemplate event.

Code:
procedure TfrEhLibForum.GetForumNameTemplate(Grid: TCustomDBGridEh; Params: TDBGridGetLaControlTemplateEventParamsEh);
begin
  if (MemTableEh1.FieldByName('forum_flags').AsString = '32') then
    Params.LaControlTemplate := FrmListGroupLaControl
  else
    Params.LaControlTemplate := FrmListItemLaControl;
end;


For an example of using the OnGetLaControlTemplate event, see the Demo project Demos\LaObjects.MainDemo\
unit Frame4EhLibForum

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 81 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group