Re: Keyboard input from widgets [message #29341] |
Wed, 13 February 2002 10:17  |
Rick Towler
Messages: 821 Registered: August 1998
|
Senior Member |
|
|
David's link is a great place to start and probably is the best general
solution for grabbing keyboard input in widgets.
The get_kbrd() function will probably not work. The problem with it is that
it requires the IDL command prompt to have focus and your application and
IDLDE can't share the focus which leads to a very awkward interface.
I tried writing some functions in C to read the keyboard but ran into the
focus problem again. (I think that RSI was using the same windows functions
to read keyboard input in their get_kbrd() function as I was in mine.) I'm
sure there is a way to trap keystrokes before they get to the OS but the
only method I know of to do this went out with Borland Turbo C 2.0 and DOS.
What I ended up with is a windows .dlm to read the accelerator keys (shift,
alt, ctrl, etc.) and to get input from the gameport. It is a start. I hope
to add extended mouse support soon. But as fun and exciting as this .dlm
is, it isn't portable.
David also mentioned that from within IDL there isn't a way to manipulate
anything more than the cursor icon. I'm sure some functions to manipulate
mouse parameters (acceleration, speed) would be fairly easy in C but I think
that would depend on your OS too.
-Rick
"Oleg Kornilov" <to_oleg@mail.ru> wrote in message
news:820c611d.0202130822.7806e3dc@posting.google.com...
> Hi,
> I have draw widget and I use mouse events in it (cursor moving and
> buttons). I need to know also what key on keyboard was pressed (for
> example, for precision moving of mouse cursor). Problem that
> base_widget does't generate events for keyboard and draw_widget
> switches into stdin (IDL command line). Probably I can use timer
> events and get_kbrd() to check keyboard buffer.
> Is there another way ?
> Thank you.
|
|
|