Re: Keyboard Events on Windows [message #39177] |
Wed, 28 April 2004 05:01 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Nuno Oliveira writes:
> You don't have any problems on processing keyboard events? I have an
> application that uses keyboard and I think that my application processes two
> events instead of one? Have this happened to you?
Oh, my goodness, yes. I am *inundated* with events!!
With draw widgets capturing keyboard events you get
one event on the press and another (nearly identical)
one on the release. They are flying at you! :-)
I'm usually only interested in an keyboard event if
it comes from a press action, not a release action,
so I have to screen the darn things out:
; Only keyboard events, please.
IF event.type LT 5 THEN RETURN
; Only PRESS events, please.
IF event.release GT 0 THEN RETURN
Now, finally, I have the events I want to deal with. It's
only a question now of screening out the individual key
presses, from the multiple key presses, from the inadvertent
key presses, etc. I'd tell you how to do this, but I've only
been working on this for a week, and ... uh, that's today's
assignment. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Keyboard Events on Windows [message #39178 is a reply to message #39177] |
Wed, 28 April 2004 03:50  |
Nuno Oliveira
Messages: 75 Registered: October 2003
|
Member |
|
|
You don't have any problems on processing keyboard events? I have an
application that uses keyboard and I think that my application processes two
events instead of one? Have this happened to you? Do you have any idea about
this? Maybe it's code error that I still haven't found. I'm working on that,
but seeing that you were working on keyboard events, I didn't resist putting
the question.
"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1af838b85109808d989730@news.frii.com...
> Folks,
>
> I'm trying to collect keyboard events in a draw widget in
> IDL 6.x with Windows 2000 Pro. I have set the KEYBOARD_EVENTS
> keyword to 2, and I am collecting keyboard events, sure enough.
>
> What I cannot do, so far, is collect the correct key when I
> try something like CNTL-s. The ASCII character reported from
> this formulation is number 19, which is listed in the Standard
> ASCII chart as "Device control 3". I have no trouble with SHIFT-s.
> (ALT-s just beeps at me as if I were trying to do something that
> would seriously damage the computer. Sigh...)
>
> Any ideas why I can't get CONTROL sequences into my event
> handler properly?
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Keyboard Events on Windows [message #39196 is a reply to message #39178] |
Tue, 27 April 2004 10:17  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
> I'm trying to collect keyboard events in a draw widget in
> IDL 6.x with Windows 2000 Pro. I have set the KEYBOARD_EVENTS
> keyword to 2, and I am collecting keyboard events, sure enough.
>
> What I cannot do, so far, is collect the correct key when I
> try something like CNTL-s. The ASCII character reported from
> this formulation is number 19, which is listed in the Standard
> ASCII chart as "Device control 3". I have no trouble with SHIFT-s.
> (ALT-s just beeps at me as if I were trying to do something that
> would seriously damage the computer. Sigh...)
>
> Any ideas why I can't get CONTROL sequences into my event
> handler properly?
I have a rule about not answering my own posts, but feel
compelled to this time. (Oh, come on, it's a joke!)
It seems the CONTROL-letter sequences are represented
by ASCII characters 1-26. (The ASCII chart I was using
didn't indicate this.) Thus CNTL-s should, in fact, be...
let's see...ellmenopee...yes, number 19.
No hope for getting ALT-s to appear, since there is
no ASCII mapping, apparently, for the ALT key.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|