Re: beeps

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

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Derek, thanks for the help. beep problem is fixed...<br>
<br>
Derek Parnell wrote:<br>
<blockquote cite="mid1054365097-1463792382-1090652872 at boing.topica.com"
 type="cite">


George Walters wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">
Well, putting in some dots to indicate missing code ended up deleting the rest
of my
message so I removed them and here it is.


I'm trying to discover why windows beeps when I "tab" through fields. It does
not beep
when I "arrow" throught fields and in my code there is no (apparent to me)
difference
between tabbing and arrowing. Look at this code
    </pre>
  </blockquote>
  <pre wrap=""><!---->
[code snipped]

It is beeping because the TAB key is being processed by the Edit field's
default Microsoft process. Normally, win32lib traps the TAB key and tabs
around the display, but because you set tabcodes to zero, Win32lib
is passing the TAB press to the edit file.

I would recommend you do the following...

a) Create a new routine to JUST move the focus depending on the UP/DOWN
direction and the current focus.
  </pre>
</blockquote>
already had one of these<br>
<br>
<br>
<blockquote cite="mid1054365097-1463792382-1090652872 at boing.topica.com"
 type="cite">
  <pre wrap="">
b) Set a handler to trap w32HKeyPress and if you get a TAB key, call
returnValue(-1). And that's all that this handler does.
  </pre>
</blockquote>
<br>
doing this fixed the beeping... thanks<br>
<blockquote cite="mid1054365097-1463792382-1090652872 at boing.topica.com"
 type="cite">
  <pre wrap="">
c) Set a handler to trap w32HKeyDown. Have this translate TAN keys into
UP or DOWN depending on the shift key. The if you have an UP or DOWN, call
the focus setting routine.

  </pre>
</blockquote>
moved the tab translate from the keypress to the keydown handler and
all is working fine now...<br>
<br>
<br>
<blockquote cite="mid1054365097-1463792382-1090652872 at boing.topica.com"
 type="cite">
  <pre wrap="">Here is some sample code:
&lt;eucode&gt;
include win32lib.ew

constant mainwin = create(Window, "main", 0, 0, 0, 200,200,0)
constant AA = create(EditText, "AA", mainwin, 10,  10, 150,20,0)
constant BB = create(EditText, "BB", mainwin, 10,  40, 150,20,0)
constant CC = create(EditText, "CC", mainwin, 10,  70, 150,20,0)
constant DD = create(EditText, "DD", mainwin, 10, 110, 150,20,0)

constant WhereTo = {AA,BB,CC,DD}
procedure MoveCursor(integer self, integer keyCode)
    integer shift

    shift = find(self, WhereTo)
    if keyCode = VK_DOWN then
        shift += 1
        if shift &gt; length(WhereTo) then
            shift = 0
        end if

    elsif keyCode = VK_UP then
        shift -= 1
        if shift &lt; 1 then
            shift = 0
        end if

    else
        shift = 0
    end if

    if shift &gt; 0 then
        setFocus(WhereTo[shift])
    end if

end procedure

procedure keyPress(integer self, integer processId, sequence arg)
    VOID = self
    VOID = processId
    if arg[1] = VK_TAB then
        returnValue(-1)
    end if
end procedure

procedure keyDown(integer self, integer processId, sequence arg)
    integer keyCode, shift
    VOID = processId
    keyCode = arg[1]
    shift   = arg[2]

    if keyCode = VK_TAB then -- make tab same as arrows
       if and_bits(shift,ShiftMask) = 0 then
           keyCode = VK_DOWN
       else
           keyCode = VK_UP
       end if
    end if

    if keyCode = VK_UP or keyCode = VK_DOWN then
        MoveCursor(self, keyCode)
    end if
end procedure
setHandler(Screen, w32HKeyDown, routine_id("keyDown"))
setHandler(Screen, w32HKeyPress, routine_id("keyPress"))

VOID = setTabCodes(0)
WinMain({mainwin,AA}, Normal)
&lt;/eucode&gt;

  </pre>
</blockquote>
</body>
</html>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu