Re: [WIN] how use <delete> key
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Mar 16, 2002
- 346 views
Derek, Your test works, so I guess I was on the right track after all. And yes there are other controls which could be taking focus, I didn't think of that; so I'll try your suggestion, thanks! I remembered that in various other situations the "Screen" constant had been appropriate to use, so I was going to search Win32Lib & see if there was a "Keyboard" constant that might have worked. Thanks again. :) Dan ----- Original Message ----- From: "Derek Parnell" <ddparnell at bigpond.com> To: "EUforum" <EUforum at topica.com> Sent: Saturday, March 16, 2002 6:24 AM Subject: Re: [WIN] how use <delete> key > > Dan, what does this test show: > ---- > constant SimpleWin = create( Window, "Simple Window", 0, 0, 0, 200, 100, > 0 ), > sb = create(StatusBar,"", SimpleWin, 0, 0, 0, 0, 0) > > procedure cc (atom keycode, atom keyshift) > setText(sb, sprintf("%d %d", {keycode, keyshift})) > end procedure > onKeyDown[SimpleWin] = routine_id("cc") > > WinMain( SimpleWin, Normal) > --------- > > Are you sure that your window has focus? It probably doesn't if there are > any input-type controls on it. In which case you need to trap the events for > the whole program. The way to do that is: > > procedure cc (atom Msg, atom wParam, atom lParam) > if Msg != WM_KEYDOWN then > return > end if > setText(sb, sprintf("%d", wParam)) > end procedure > onEvent[Screen] = routine_id("cc") > > ----- > > The <delete> key should be code '46'. Hope this helps. > > Derek. > > ----- Original Message ----- > From: "Dan Moyer" <DANIELMOYER at prodigy.net> > To: "EUforum" <EUforum at topica.com> > Sent: Sunday, March 17, 2002 1:08 AM > Subject: [WIN] how use <delete> key > > > > I can't figure out how to use the <delete> key in a program using > Win32Lib. > > > > Specifically, I can't set up the event trap for onKeyDown; I could make > the > > filter for the <delete> key itself, but I can't figure out how to write > the > > trap itself. > > > > I tried "onKeyDown[MainWindow]=routine_id("onKeyDown_LookForDeleteKey")", > > with a notify message to status bar in the referenced routine, but that > > didn't seem to do anything. (The routine was empty except for the notify > > message, so I thought it should respond to any keypress?) > > > > Any helpful suggestions would be appreciated. > > > > Dan Moyer > > > > > > >