Push Button - ButtonCancel Property

Set to true to fire the click event when the escape key is pressed

Member of Push Button (PRIM_PHBN)

Data Type - Boolean


The ButtonCancel property associates the button to the Escape key.
When True, pressing the Escape key will fire the Click event.
Only one button can be set to True.


This form shows the use ButtonDefault and ButtonCancel.
Whenever Enter is pressed, "OK " is added to the caption.  Whenever the Escape key is used, the form closes.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(387) Clientheight(161) Componentversion(2) Top(228) Left(267)
   Define_Com Class(#PRIM_PHBN) Name(#OK) Caption('&OK') Displayposition(1) Left(206) Parent(#COM_OWNER) Tabposition(1) Top(128) Buttondefault(True)
   Define_Com Class(#PRIM_PHBN) Name(#Cancel) Caption('&Cancel') Displayposition(2) Left(303) Parent(#COM_OWNER) Tabposition(2) Top(128) Buttoncancel(True)
   Evtroutine Handling(#OK.Click)
      #Com_owner.Caption += "OK "
   Evtroutine Handling(#Cancel.Click)

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2