1. setHandler not works after checkBox ?

-------------------------------------------------------- 
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?

new topic     » topic index » view message » categorize

2. Re: setHandler not works after chekBox ?

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.

new topic     » goto parent     » topic index » view message » categorize

3. Re: setHandler not works after chekBox ?

Thanks Derek.

That solved my question.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu