Re: Capture F5 Keystroke

From: Donald (donn_at_1starnet.com)
Date: 11/26/03


Date: Tue, 25 Nov 2003 21:28:52 -0600

This code does not work.

Ideas?

procedure TfrmMain.FormKeyPress(Sender: TObject; var Key: Char);
begin

  if key = 'VK_F5' then
  begin
     ShowMesage('The F5 key was pressed!','');
  end;

end;

"BruSoft" <bruce@bru-soft.com> wrote in message
news:3fc41bb9$1@newsgroups.borland.com...
> Donlad wrote:
>
> >Can some help figure out how to capture if F5 is pressed.
> >
> >
> Key is passed to the OnKeyUp, OnKeyDown, etc. events. Check if Key
> = VK_F5
>
> >
> >secondly when the users closes the app clicking the x in the top right,
how
> >do I show a message box asking are you sure. I can display the message
box,
> >but not sure how to cancel the terminate.
> >
> >
> In the OnCloseQuery event on the form put your message box and if
> you want to cancel the close, set the CanClose parameter sent into the
> event to False.
>
> >
> >Thanks
> >
> >Donald
> >
> >
> >
> >
>
>
> --
> Bruce Michener http://www.bru-soft.com
>



Relevant Pages

  • Re: Capture F5 Keystroke
    ... Key is passed to the OnKeyUp, OnKeyDown, etc. events. ... >secondly when the users closes the app clicking the x in the top right, ... >but not sure how to cancel the terminate. ...
    (borland.public.delphi.language.objectpascal)
  • Canceling OnKeyUp Event within a module
    ... I was wondering if someone might be able to help me figure out how to cancel the onKeyUp action if the current key being pressed is the tab key. ... Cancel on key up event (will not fire) 'if the tab key is the key pressed being pressed then I don't want the event to fire. ...
    (microsoft.public.access.modulesdaovba)