Components for Delphi and C++ Builder.

Go to Russian forum
Go to EhLib.com
It is currently 28 Mar 2024, 22:00

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 30 Jan 2018, 12:23 
Offline

Joined: 16 Aug 2017, 14:24
Posts: 6
How could i make work events like "on key press", or "on key down" for fields in DBGridEh? For example i have columns "name" and "last name" in DBGridEh. I want to show some form related to current field from DBGridEh when user press F6 button. I don't want to make this work for whole DBGrid, but only for some columns, and i also want to do different kind of stuff for other columns. Thank you in advance!


Top
 Profile  
 
PostPosted: 05 Feb 2018, 14:21 
Offline

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

You can use DBGridEh1.SelectedField to determine which field is now focused in the grid.

Code:
procedure TForm1.DBGridEh1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if (Key = VK_F6) and
     ((DBGridEh1.SelectedField.FieldName = 'Name') or (DBGridEh1.SelectedField.FieldName = 'Capital')) then
  begin
    ShowMessage('F6 and FieldName = ' + DBGridEh1.SelectedField.FieldName);
  end;
end;

_________________
Best regards
EhLib Support Team


Top
 Profile  
 
PostPosted: 06 Feb 2018, 06:00 
Offline

Joined: 16 Aug 2017, 14:24
Posts: 6
Thank you very much!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 9 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:  
cron
Powered by phpBB® Forum Software © phpBB Group