Solved

Delphi: Catch F8 keypress

Posted on 2009-06-30
3
1,160 Views
Last Modified: 2012-05-07
Hi all

I have a TOvcPictureField which contains a date. I want to be able to change the date up and down by pressing the F7 and F8 buttons when the field is in focus. I can do it with the '+' and '-' keys using this code:

Case Key of
    '+' : edtFromDate.AsDateTime:=edtFromDate.AsDateTime+1;
    '-' : edtFromDate.AsDateTime:=edtFromDate.AsDateTime-1;
    else

But I can't find out what the code for the F7 and F8 keys are. Can anyone help?

Regards
Søren Augustesen
0
Comment
Question by:poultarp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
Causality earned 334 total points
ID: 24743051

F7  is 118
F8  is 119
0
 
LVL 2

Assisted Solution

by:Causality
Causality earned 334 total points
ID: 24743058
Case Key of
    chr(118) : edtFromDate.AsDateTime:=edtFromDate.AsDateTime+1;
    chr(119) : edtFromDate.AsDateTime:=edtFromDate.AsDateTime-1;
0
 
LVL 37

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 166 total points
ID: 24744776
this gets passed with the keydown event, not keypress event
in the OnKeyDown (or OnKeyUp)

from windows unit

  VK_F7 = 118;
  VK_F8 = 119;

procedure TForm1.cbbAccountKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    VK_F7: edtFromDate.AsDateTime:=edtFromDate.AsDateTime+1; // F7 down
    VK_F8: edtFromDate.AsDateTime:=edtFromDate.AsDateTime-1; // F8 down
  end;    
end;
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question