1. Problem with OnKeyDown in win32lib
What is actually being returned by this? It doesn't make sense to me.
I have programs where I want to be able to deal with regular keys, cursors
and function keys all in the same loop, and when I press p it equates to F1
etc. I have dos32 programs that deal with the returned scancodes just fine,
but this doesn't match. Help!
2. Re: Problem with OnKeyDown in win32lib
Here's a silly example:
procedure do_Choice1(integer key)
if key=13 then setCheck(Choice1,1) setCheck(Choice2,0) setCheck(Choice3,0)
elsif key=#28 then setFocus(Choice2)
elsif key=#26 then setFocus(Button11) end if
end procedure
onKeyDown[Choice1] = routine_id("do_Choice1")
( 13, #28, and #26 translate to VK_RETURN, VK_DOWN, and VK_UP. )
( Choice1 is just a button )
Wolf
3. Re: Problem with OnKeyDown in win32lib
John Coonrod wrote:
> What is actually being returned by onKeyDown?
As the HTML documentation notes:
The scanCode is "raw" value of the key.
The primary purpose of onKeyDown is to trap "special" keys
not reported by onKeyPress.
onKeyPress traps 'visible' keys (such as 'A'); onKeyDown traps keys that are
'navigation' (invisible), such as PageUp. Take a look in the the file for
constants labled VK_ for key values.
This division between visible/navigation keys is imposed by Windows, not me.
I've considered wrapping the function so *any* keypress triggers a single
callback, but there's an issue (as you found): there is an overlap between
the key codes returned by 'visible' and 'navigation' keys. So for the moment
I'm leaving it alone.
Hope this helps.
-- David Cuny