Keyboard input from widgets [message #29346] |
Wed, 13 February 2002 08:22  |
to_oleg
Messages: 2 Registered: December 2001
|
Junior Member |
|
|
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.
|
|
|
|
Re: Keyboard input from widgets [message #29443 is a reply to message #29414] |
Wed, 20 February 2002 19:42  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
Altyntsev Dmitriy wrote:
>
> I use for this purpose widget_text trick
> (it's visible because there are situations when focus nevertheless
> become lost) and TVCRS to position cursor on widget_draw. The only
> inconvenience is widget_text does not catch arrow keys and one should
> use some text keys.
> I would recommend "ASDW" keys - standard direction keys in games
> (a pair hours of Quake and you'll forget about arrows :-))
>
> Probably it can be overcome if use widget_table instead of
> widget_text. Table cell selection events catch arrow keys and edit
> cell mode catch text keys. But I didn't check it.
>
> Altyntsev Dmitriy,
> Remote Sensing Center
> Irkutsk, Russia
> http://ckm.iszf.irk.ru
>
> to_oleg@mail.ru (Oleg Kornilov) 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.
I posted an update to my widget_text trick a long while back which in
fact traps arrow keys too. It is even more of a hack:
widget_control, self.wHid,/INPUT_FOCUS,set_value=['..','..','..'], $
SET_TEXT_SELECT=self.base_pos
You can then detect arrow keys using WIDGET_TEXT_SEL events, and the
TEXT_OFFSET_TO_XY keyword to widget_info(). Highly hackish, works
poorly on some systems, but overall, fun to use.
You can read more about it here:
http://groups.google.com/groups?selm=392B1991.CB765706%40ast ro.cornell.edu
I have a general purpose keyboard processing object which is part of a
large framework of image tools I'm hoping to release "real soon now".
Watch this space.
JD
|
|
|