1. Re: [WIN] how use <delete> key
- Posted by Dan Moyer <DANIELMOYER at prodigy.net> Mar 16, 2002
- 346 views
Thanks Pete, Haven't tried Derek's suggestion yet, but it should work. Dan ----- Original Message ----- From: <petelomax at blueyonder.co.uk> To: "EUforum" <EUforum at topica.com> Subject: Re: [WIN] how use <delete> key On Sat, 16 Mar 2002 06:08:27 -0800, Dan Moyer <DANIELMOYER at prodigy.net> wrote: >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. > That works fine in the editor, using -- win32lib v0.55.5 as modified by Martin Stachon. Here's a copy of the relevant lines, complete with some editor-specific -ve keycode handling. Can't see it will help though. procedure keyboardEvent(integer keycode, integer shift) ... if keycode < 0 then -- control key pressed keycode = 0 - keycode -- make +ve ... if keycode = VK_DELETE then ... end procedure procedure convertSpecialKeys(integer keycode, integer shift) -- send special keys as negative to distinguish from 'normal' keys keyboardEvent( 0 - keycode, shift ) end procedure onKeyDown [ MAIN ] = routine_id("convertSpecialKeys") onKeyPress [ MAIN ] = routine_id("keyboardEvent")