Re: beep

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

Since you are using this old version, you will need to patch it.
In the routine fDoKeys() locate the line ....

   if iMsg = WM_CHAR and sequence(lUserReturn) then

and replace it with ...

   if sequence(lUserReturn) then

Here is the code that I used to test it...

include win32lib.ew
without warning

constant Main = create(Window, "key test", 0, 0, 0, 360, 190, 0)
constant EB   = create(EditText, "", Main, 5, 5, 340, 30, 0)
constant SB   = create(StatusBar, "", Main, 0, 0, 0, 0, 0)

procedure SpecialKeyProcess(integer self, integer processId, sequence arg)
    setText(SB, sprintf("SPECIAL %d %d %d", {processId, arg[1], arg[2]}))
end procedure    

procedure NormalKeyProcess(integer self, integer processId, sequence arg)
    setText(SB, sprintf("NORMAL %d %d %d", {processId, arg[1], arg[2]}))
end procedure    

--------------------------------------------------------------------------
procedure keyDownProcess(integer self, integer processId, sequence arg)

     integer keyCode, shift
    
keyCode = arg[1]
shift   = arg[2]
     
     if find (keyCode, { VK_DOWN, VK_UP, VK_F1, VK_F2}) then
        SpecialKeyProcess(self, processId, {keyCode, shift})
        returnValue(-1)
    else
        NormalKeyProcess(self, processId, {keyCode, shift})
    end if
end procedure

--------------------------------------------------------------------------
procedure keyPressProcess(integer self, integer processId, sequence arg)

     integer keyCode, shift

     
keyCode = arg[1]
shift   = arg[2]
     if find (keyCode, {VK_ESCAPE, VK_TAB,VK_RETURN }) then
        SpecialKeyProcess(self, processId, {keyCode, shift})
        returnValue(-1)
    else
        NormalKeyProcess(self, processId, {keyCode, shift})
    end if

end procedure

setText(Main, sprintf("Win32Lib version %d.%d Patch#%d, %s",
                    {Win32LibVersion[1],
                     Win32LibVersion[2],
                     Win32LibVersion[3],
                     Win32LibVersion[4]
                    }))

setHandler(Screen, w32HKeyPress, routine_id("keyPressProcess"))
setHandler(Screen, w32HKeyDown, routine_id("keyDownProcess"))
-------------------------------------------------------------------------------------
WinMain(Main,Normal)


But back to the reason you are using the old version of win32lib. Are
you saying that you have placed a Group control on the window and
placed other control 'underneath' the group control and that they
are visible when you do that? If so, that is NOT correct behaviour and
I'm glad that I fixed that. The idea for Group control is to make this
the parent of controls you wish to see inside it. If you just wanted
to draw a box with title aound them, it would have been better to draw
a box around them and place a title on it (via the paint event).

-- 
Derek Parnell
Melbourne, Australia

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu