1. [ WIN ] re: onKeyPress[]

.. in win32lib.
I recently wrote a program using the following simple...

procedure on_key(integer key,integer shift)
if key=VK_RETURN then
my_handler()
end if
end procedure
--
onKeyPress[button]=routine_id("on_key")

.. and found that even after this routine was handled, the keypress was
*still* in the message queue.

So, to get rid of this, I did the obvious:

procedure on_key(integer key,integer shift)
atom jk
if key=VK_RETURN then
---- dispose of message !
---- etc.

So, my question here is:
.. if onKeyPress[] doesn't actually dispose of the message,
what in win32lib eventually does ?

.. and could this cause some potential problems.

Wolf

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

new topic     » topic index » view message » categorize

2. Re: [ WIN ] re: onKeyPress[]

> Try using returnValue( 1 ) (or 0).  This is usually a signal to DefWndProc
> that the app has handled an event, and the default handler shouldn't be

Honestly, I've *tried* returnValue() numerous times in the past, and have
never accomplished anything with it.
Maybe I just don't understand it's intended application, and I've never seen
a "definitive" example that demonstrates it's uses, ( plural ! ).
< hint...hint >

My problem *was* complicated by the fact that I'm doing thread 'hooking',
with two call_backs, and a private MSG structure for these as well, ( is this
legal ? )
 --- but maybe not ---.

Wolf

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

new topic     » goto parent     » topic index » view message » categorize

3. Re: [ WIN ] re: onKeyPress[]

Hi Wolf,
I quote here from the win32lib documentation...

-------------------------------
If you want to to Windows to ignore the key, set the return value to -1.

if find(keyCode,"0123456789") then
    returnValue(-1) -- ignore digits.
end if
If you want to to Windows to use a different key, set the return value to
the new key.

-- collect characters into the password, but don't show them.
PassWord &= keyCode
returnValue('-') -- return a dash for each character entered.

---------------------
I hope this is what you're after.

------
Derek Parnell
Melbourne, Australia
(Vote [1] The Cheshire Cat for Internet Mascot)

----- Original Message -----
From: "Wolf" <wolfritz at KING.IGS.NET>
To: "EUPHORIA" <EUforum at topica.com>
Sent: Wednesday, January 31, 2001 2:53 AM
Subject: [ WIN ] re: onKeyPress[]


> ... in win32lib.
> I recently wrote a program using the following simple...
>
> procedure on_key(integer key,integer shift)
> if key=VK_RETURN then
> my_handler()
> end if
> end procedure
> --
> onKeyPress[button]=routine_id("on_key")
>
> ... and found that even after this routine was handled, the keypress was
> *still* in the message queue.
>
> So, to get rid of this, I did the obvious:
>
> procedure on_key(integer key,integer shift)
> atom jk
> if key=VK_RETURN then
> ---- dispose of message !
> jk=w32Func(xGetMessage,{MSG,getHandle(button),WM_KEYFIRST,WM_KEYLAST})
> ---- etc.
>
> So, my question here is:
> ... if onKeyPress[] doesn't actually dispose of the message,
> what in win32lib eventually does ?
>
> ... and could this cause some potential problems.
>
> Wolf
>
> ____________________________________________________________
> T O P I C A  -- Learn More. Surf Less.
> Newsletters, Tips and Discussions on Topics You Choose.
> http://www.topica.com/partner/tag01
>

____________________________________________________________
T O P I C A  -- Learn More. Surf Less. 
Newsletters, Tips and Discussions on Topics You Choose.
http://www.topica.com/partner/tag01

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu