Re: Win32Lib Question
- Posted by Irv Mullins <irv at ELLIJAY.COM> Sep 16, 1999
- 491 views
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