Shortcut Key (PRIM_STPG)

Shortcut Key

Ancestors - Object (PRIM_OBJT)

Details

A Shortcut key allows for the simple monitoring of a key or key combination without the need to manage KeyPress events on many controls.
 
When the key is pressed, the Pressed is fired.
 
Forms with a FormStyle of NormalChild, OwnedChild or StayOnTopChild will route their key presses to their owner form.

Example

In this example, F4 and F5 can be used regardless of which control has focus.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(757) Clientheight(338) Componentversion(2) Top(214) Left(118)
 
   Define_Com Class(#prim_stpg) Name(#F4) Shortcut(F4) Parent(#COM_OWNER)
   Define_Com Class(#prim_stpg) Name(#F5) Shortcut(F5) Parent(#COM_OWNER)
 
   Define_Com Class(#EMPNO.Visual) Name(#EMPNO) Componentversion(1) Displayposition(1) Height(21) Left(8) Parent(#COM_OWNER) Tabposition(1) Top(6) Usepicklist(False) Width(251)
   Define_Com Class(#SURNAME.Visual) Name(#SURNAME) Displayposition(2) Left(8) Parent(#COM_OWNER) Tabposition(2) Top(28)
   Define_Com Class(#GIVENAME.Visual) Name(#GIVENAME) Displayposition(3) Left(8) Parent(#COM_OWNER) Tabposition(3) Top(50)
   Define_Com Class(#ADDRESS1.Visual) Name(#ADDRESS1) Displayposition(4) Left(8) Parent(#COM_OWNER) Tabposition(4) Top(72)
   Define_Com Class(#ADDRESS2.Visual) Name(#ADDRESS2) Componentversion(1) Displayposition(5) Height(21) Left(8) Parent(#COM_OWNER) Tabposition(5) Top(94) Usepicklist(False) Width(537)
   Define_Com Class(#ADDRESS3.Visual) Name(#ADDRESS3) Componentversion(1) Displayposition(6) Height(21) Left(8) Parent(#COM_OWNER) Tabposition(6) Top(116) Usepicklist(False) Width(537)
   Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') Displayposition(7) Left(8) Parent(#COM_OWNER) Tabposition(7) Top(144)
   Define_Com Class(#PRIM_PHBN) Name(#Button2) Caption('Button2') Displayposition(8) Left(96) Parent(#COM_OWNER) Tabposition(8) Top(144)
 
   Evtroutine Handling(#F4.Pressed)
 
      #Com_owner.Caption := F4
 
   Endroutine
 
   Evtroutine Handling(#F5.Pressed)
 
      #Com_owner.Caption := F5
 
   Endroutine
 
End_Com

Properties

NameDescription
ComponentClassNameComponentClassName is the name of the component's class. Inherited from Object (PRIM_OBJT)
ComponentMembersComponentMembers provides access to all the member components of this component Inherited from Object (PRIM_OBJT)
ComponentPatternNameComponentPatternName is used to qualify the class of the component. Inherited from Object (PRIM_OBJT)
ComponentTagGeneric space allowing a value to be stored for the instance Inherited from Object (PRIM_OBJT)
ComponentTypeComponentType gives you access to the type information about the component Inherited from Object (PRIM_OBJT)
ComponentTypeNameComponentTypeName is the fully qualified name of the component's class. Inherited from Object (PRIM_OBJT)
EnabledEnable activates/deactivates the component
NameName identifies the component Inherited from Object (PRIM_OBJT)
OwnerOwner owns this component Inherited from Object (PRIM_OBJT)
ParentReference to the control containing the shortcut key
ShortCutKeyboard shortcut used to fire the Pressed event

Events

NameDescription
CreateInstanceCreateInstance is signalled when an instance of a component is created Inherited from Shortcut Key (PRIM_STPG)
DestroyInstanceDestroyInstance is signalled when an instance of a component is about to be destroyed Inherited from Shortcut Key (PRIM_STPG)
PressedFired when the key is pressed

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2