- subclassing buttons
- Posted by flintridgeparkenfarker vonkerschnauzerheiden III \(joe\) on July 11th, 2003
In a button callback I trap a keydown event and if the key is "Return" I
call a function which for no apparent reason returns to the WM_COMMAND >
BUTTON_ID event before the function ends. If I simply click the button the
WM_COMMAND > BUTTON_ID event executes once. If I use the "Return" key when
the button has the focus, the WM_COMMAND > BUTTON_ID message is received
twice.
Is there some way to trap the "Return" keydown without receiving two
BUTTON_ID messages or is something else probably wrong?
Thanks.
joe
--
"To be is to do."--Plato.
"To do is to be."--Socrates.
"Do be do be do."--Sinatra.
- Posted by John Carson on July 12th, 2003
"flintridgeparkenfarker vonkerschnauzerheiden III (joe)"
<skid@nospam.com> wrote in message
news:vguh3g211ed317@corp.supernews.com
I can't follow what you are doing, but WM_KEYDOWN for Enter will be
immediately followed by a WM_CHAR message for Enter. Your double message
problem could be tied up with this in some way.
--
John Carson
1. To reply to email address, remove donald
2. Don't reply to email address (post here instead)
- Posted by flintridgeparkenfarker vonkerschnauzerheiden III \(joe\) on July 12th, 2003
"John Carson" <donaldquixote@datafast.net.au> wrote in message
news:3f0f8f52$1@usenet.per.paradox.net.au...
: "flintridgeparkenfarker vonkerschnauzerheiden III (joe)"
: <skid@nospam.com> wrote in message
: news:vguh3g211ed317@corp.supernews.com
: > In a button callback I trap a keydown event and if the key is
: > "Return" I call a function which for no apparent reason returns to
: > the WM_COMMAND > BUTTON_ID event before the function ends. If I
: > simply click the button the WM_COMMAND > BUTTON_ID event executes
: > once. If I use the "Return" key when the button has the focus, the
: > WM_COMMAND > BUTTON_ID message is received twice.
: >
: > Is there some way to trap the "Return" keydown without receiving two
: > BUTTON_ID messages or is something else probably wrong?
: >
: > Thanks.
: >
: > joe
: >
: > --
: > "To be is to do."--Plato.
: > "To do is to be."--Socrates.
: > "Do be do be do."--Sinatra.
:
:
:
: I can't follow what you are doing, but WM_KEYDOWN for Enter will be
: immediately followed by a WM_CHAR message for Enter. Your double message
: problem could be tied up with this in some way.
:
:
: --
: John Carson
: 1. To reply to email address, remove donald
: 2. Don't reply to email address (post here instead)
:
I ended up using a counter to decide on processing the message or not. I
feel like I've "jerry-rigged" the thing by doing it this way though. The
structure is like this:
window procedure(...) {
switch(msg) {
case wm_command... etc.
case button_id: SomeFunction(); return 0;
}
}
Button CALLBACK Procedure(...) {
if (wparam==vk_return) SomeFunction();
}
SomeFunction(...) {
calls several other functions, none of which send any window msgs
then somewhere in here, before this function ends, another button_id
message is received and this function is called again before it even ends
the first time, as if it had recursed
}