Re: Win32Lib Question

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

On Wed, 15 Sep 1999, you wrote:
> Irv wrote:
>
> >I need to write a Windows program which will respond to keystrokes
> >regardless of which control has focus.
> >
> >onKeyPress[ x ] works if x is a control, but not if x is the main Win.
>
> It should work just fine, no matter what the window is.

Well - it does, sort of...

If you have a window with zero controls, it works. Add a listbox, for example,
and the keystrokes are no longer trapped.

Example:
include win32lib.ew
integer key
sequence kp

constant Win = create(Window, "Test",0,Default,Default,640,420,0),
-- Uncomment the following line to break the program:
--  List1 = create(List,"",Win,100,100,80,140,0)

procdure kep (object a)
 wPrintf(Win,"%s\n",{a})
-- doesn't really matter whether you  print, or call procedures
-- based on the value of 'a', it quits working when a control
-- is added.
end procedure
onKeyPress [Win] = routine_id("kep")

 WinMain (Win,Normal)

Irv

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

Search



Quick Links

User menu

Not signed in.

Misc Menu