Re: beep
- Posted by Derek Parnell <ddparnell at bigpond.com> Oct 02, 2004
- 610 views
George Walters wrote: > > Well, I guess I don't understand the issue of windows(xp) beeping. I've > spend several days trying to remove the annoyance and have failed. The > escape, enter, and tab keys beep eventhough I've placed returnValue(-1). > Perhaps I've put in at the wrong place in the code. Interesting is > that if instead of using 'keyDown' I use 'keyPress' the beeping stops > but then I have the 'q' having the same keyCode as 'F2'problem. Here's a > snip of the code > > If anyone has a hint of where to look please clue me in... > BTW, I'm using win32 59.1 > > }}} <eucode> > -------------------------------------------------------------------------- > procedure keyDownProcess(integer self, integer processId, sequence arg) > > integer keyCode, shift > > > keyCode = arg[1] > shift = arg[2] > > if find (keyCode, {esc, tab, downArrow, upArrow, cr, f1, > f2, f3 , f4, f5, f6, f7, f8, f9, f10}) then > > SpecialKeyProcess(self, processId, {keyCode, shift}) > returnValue(-1) > > else > > NormalKeyProcess(self, processId, {keyCode, shift}) > > end if > > end procedure > > > -- setHandler(Screen, w32HKeyPress, routine_id("keyPressProcess")) > setHandler(Screen, w32HKeyDown, routine_id("keyDownProcess")) > > ------------------------------------------------------------------------------------- > WinMain(Main,Normal) > </eucode> {{{ I think the problem is because ESC, TAB, CR are also KeyPress events and when you throw away the keydown (returnValue(-1)) Windows gets confused because it gets a keyup event with out the matching keydown so it can't assume its a valid keypress so it beeps an alert. Why are you throwing away these keys? You don't have to get rid of the function and arrow keys because most controls don't use them anyhow. Its easier to get rid of the other keys during a keypress anyway. I can't seem to get the beeps on my system but I'll try some different tests. -- Derek Parnell Melbourne, Australia