Solved

Delphi: Catch F8 keypress

Posted on 2009-06-30
3
1,167 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 38

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

623 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