Re: Win32Lib: Keypress Issue
- Posted by Derek Parnell <ddparnell at bigpond.com> Aug 06, 2004
- 395 views
cklester wrote: > > Derek, anything wrong with this code? 'cuz it ain't workin'. (I've > thrown the win_FullScreen up for display from another window > (win_Main), and now I want to press ESC to make it go away.) > > procedure win_FullScreen_onKeyPress (integer self, integer event, sequence > params)--params > is ( int keyCode, int shift ) > if params[1] = VK_ESCAPE and fullScreenView then > fullScreenView = w32False > closeWindow( win_FullScreen ) > end if > end procedure > setHandler( Screen, w32HKeyPress, routine_id("win_FullScreen_onKeyPress")) > The code looks fine (and works here) so I guess the 'fullScreenView' is not being set correctly or is being set to w32False somewhere else. Here is the code I used to test it...
without warning include win32lib.ew integer fullScreenView fullScreenView = w32False constant mw = create(Window, "Main", 0, 0, 0, 100, 100, 0) constant win_FullScreen = create(Window, "FULL", 0, 200, 200, 400, 400, 0) procedure win_FullScreen_onKeyPress (integer self, integer event, sequence params)--params is ( int keyCode, int shift ) if params[1] = VK_ESCAPE then if fullScreenView = w32True then closeWindow( win_FullScreen ) else openWindow(win_FullScreen, Normal) end if end if end procedure setHandler( Screen, w32HKeyPress, routine_id("win_FullScreen_onKeyPress")) procedure win_FullScreen_onActivate (integer self, integer event, sequence params) fullScreenView = w32True end procedure setHandler( win_FullScreen, w32HActivate, routine_id("win_FullScreen_onActivate")) procedure win_FullScreen_onClose(integer self, integer event, sequence params) fullScreenView = w32False end procedure setHandler( win_FullScreen, w32HClose, routine_id("win_FullScreen_onClose")) openWindow(win_FullScreen, Normal) WinMain(mw, Normal)
-- Derek Parnell Melbourne, Australia