RAD Studio VCL Reference
|
Occurs when the user presses a key (before the OnKeyDown event).
property OnShortCut: TShortCutEvent;
__property TShortCutEvent OnShortCut;
Use OnShortCut to dispatch shortcut keystrokes before the form or its controls handle them. When the user presses a key, the application can dispatch it as a shortcut key instead of allowing the standard keystroke processing (OnKeyDown, OnKeyPress, and OnKeyUp). Built-in shortcut processing is provided for menu shortcuts and actions associated with the form. OnShortCut lets the application implement additional shortcuts.
If the OnShortCut event handler responds to the keystroke, set its Handled parameter to true. This prevents the keystroke from being passed on to menus or actions associated with the application. It also prevents the standard keystroke processing in the same way that a menu or action shortcut does.
C++ Examples:
/* This example requires a TApplicationEvents and a TListBox in the form. Select the TApplicationEvents, double click on the OnShortCut event and add the following code to the handler. Trigger this event by pressing the CTRL key or any function key. */ void __fastcall TAppEventForm::ApplicationEventsShortCut(TWMKey &Msg, bool &Handled) { lbOther->Items->Add("Event OnShortCut"); }
Delphi Examples:
{ This example requires a TApplicationEvents and a TListBox in the form. Select the TApplicationEvents, double click on the OnShortCut event and add the following code to the handler. Trigger this event by pressing the CTRL key or any function key. } procedure TMainForm.ApplicationEventsShortCut(var Msg: TWMKey; var Handled: Boolean); begin lbOther.Items.Add('Event OnShortCut'); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|