Re: Win32Lib Losing Keys

new topic     » goto parent     » topic index » view thread      » older message » newer message

Pete Lomax wrote:
> 
> The following trick will allow the user to deliberately tab to a
> control and press space to click it, but then the button loses focus
> and 'normal' keyboard handling resumes, which is probably better than
> an outright ban on space activating a button.
> 
> To be honest, the spacebar both activates the button AND appears on
> the statusbar, so a further small tweak may be required.
> 
> procedure Window1_onKeyPress (integer self, integer event, sequence
> params)--params is ( int keyCode, int shift )
> 	setText(StatusBar2, "Got key " & params[1] & "." )
> 	if self=PushButton4 then 
> 		setEnable(PushButton4,False)
> 		setFocus(Window1) 
> 		setEnable(PushButton4,True)

I don't understand why setFocus(Window1) doesn't do the job
sufficiently here. However, your suggestion does work for me!

> 	end if
> end procedure
> setHandler( {Window1,PushButton4}, w32HKeyPress,
> routine_id("Window1_onKeyPress"))

Using setHandler(Screen,...) works fine.

-=ck
"Programming in a state of EUPHORIA."

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu