1. setHandler not works after checkBox ?
- Posted by SergioGelli Sep 08, 2010
- 1279 views
- Last edited Sep 09, 2010
-------------------------------------------------------- include win32Lib.ew constant winMaster = create(Window,"JPG Saver", 0,Default,Default,600,400,0) ,tooLBar = create(ToolBar, "", winMaster, 0, 0, 400, 40, 0) ,fitToCenter = create(CheckBox, "AutoCenter",tooLBar, 265, 12, 85, 25,{WS_CHILD,BS_AUTOCHECKBOX,WS_VISIBLE}) procedure onkeyUp(integer xx, integer yy, sequence parms) if isChecked(fitToCenter) then closeWindow(winMaster) -- turn off app else setText(winMaster,"test") -- show setHandler work) end if end procedure setHandler(winMaster, w32HKeyUp, routine_id("onkeyUp")) WinMain(winMaster, Normal)
This seems a simple code, but I could not make it work, with WinXP + Eu311.
Why the line
"setHandler(winMaster, w32HKeyUp, routine_id("onkeyUp"))"
does not work after changing the checkbox?
What should I do for work?
2. Re: setHandler not works after chekBox ?
- Posted by DerekParnell (admin) Sep 08, 2010
- 1268 views
SergioGelli said...
Why the line
"setHandler(winMaster, w32HKeyUp, routine_id("onkeyUp"))"
does not work after changing the checkbox?
It doesn't work because clicking in the checkbox changes the keyboard's focus from the window to the checkbox, but the handler you have is only looking for KeyUp events that happen to the window.
Try this instead ...
setHandler(Screen, w32HKeyUp, routine_id("onkeyUp"))
This will cause the handler code to react to every KeyUp event regardless of which control has focus at the time.
3. Re: setHandler not works after chekBox ?
- Posted by SergioGelli Sep 08, 2010
- 1190 views
Thanks Derek.
That solved my question.