Re: Win32Lib Losing Keys
cklester wrote:
>
> Can somebody please help me with this problem? Run the code below.
> Type anything. You'll see the result in the statusbar. Now click the
> button. Try typing again. No KeyPress response.
>
> You can try setting the onClick event for the button to setFocus(Window1)
> but it still won't work. How do I make the button lose focus again so
> the Window can receive key events? Or should I go about this difrerently?
It all depends on what you are trying to achieve. Is it really important that
you react to the Window, rather than *any* other control, getting a key
event?
My guess is that you wish to do something when a certain key is pressed,
regardless of which control currently has focus. If that is so,
trying using
setHandler(Screen, w32HKeyDown, ...)
this will trap all key presses, regardless of which control currently
has focus. If you need to know which control has focus, call the
getSelf() function inside the Screen-event handler.
> Thanks!!!
>
> -- code generated by Win32Lib IDE v0.18.14
>
> include Win32Lib.ew
> without warning
>
>
> --------------------------------------------------------------------------------
> -- Window Window1
> constant Window1 = createEx( Window, "Window1", 0, Default, Default, 434, 352,
> 0, 0
> )
> constant StatusBar2 = createEx( StatusBar, "StatusBar2", Window1, 0, 0, 0, 0,
> 0, 0
> )
> constant PushButton4 = createEx( PushButton, "PushButton4", Window1, 96, 124,
> 88, 28,
> 0, 0 )
> ---------------------------------------------------------
>
> --------------------------------------------------------------------------------
> procedure Window1_onKeyPress (integer self, integer event, sequence
> params)--params
> is ( int keyCode, int shift )
> setText(StatusBar2, "Got key " & params[1] & "." )
> end procedure
> setHandler( Window1, w32HKeyPress, routine_id("Window1_onKeyPress"))
>
> WinMain( Window1,Normal )
>
> -=ck
> "Programming in a state of EUPHORIA."
>
--
Derek Parnell
Melbourne, Australia
|
Not Categorized, Please Help
|
|