Error command On Key
Posted: Thu Aug 04, 2011 2:09 pm
Friends, I am having problems with Command On Key.
If I use the button to close the window, it works fine. But if you press ESC, it gives the error message: "demo_onkey.exe has encountered a problem and needs to close"
Code: Select all
#include "hbqtgui.ch"
#include "hmg.ch"
#include "i_keybd.ch"
FUNCTION Main
LOCAL oWindow, oButton1
HbQt_ErrorSys()
WITH OBJECT oWindow := Window():New()
:Row := 10
:Col := 10
:Width := 400
:Height := 400
:Title := 'Nice OOP Demo!!!'
:Type := WND_MAIN
:OnInit := { || oWindow:Center() }
WITH OBJECT oButton1 := Button():New("oButton1")
:Row := 40
:Col := 40
:Width := 180
:Caption := 'Close Window'
:OnClick := { || oWindow:Release() }
END WITH
END WITH
On key ESCAPE of oWindow Action oWindow:Release()
oWindow:Activate()
RETURN NIL