[Gambas-user] KeyPress Escape to close a form

Benoît Minisini gambas at ...1...
Fri Jan 31 19:31:02 CET 2014


Le 31/01/2014 19:25, Tobias Boege a écrit :
> On Fri, 31 Jan 2014, abbat81 wrote:
>> How to make an event for Key Press Escape button to close a form
>> Thanks
>>
>
> Do you mean:
>
> Public Sub Form_KeyPress()
>    If Key.Code = Key.Esc Then Me.Close()
> End
>
> This has nothing to do with a Button you were mentioning in the question but
> honestly, I don't see how Buttons may be connected to this...
>
> Regards,
> Tobi
>

They are: Buttons have a Cancel and a Default property for that. The 
"Cancel" button is activated  by the ESC key, the "Default" button is 
activated by the RETURN key. But it does not close anything by default! 
You must handle the buttons click events for that.

-- 
Benoît Minisini




More information about the User mailing list