comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Mouse and keyboard events in a draw widget
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Mouse and keyboard events in a draw widget [message #10543] Wed, 17 December 1997 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
James Albert (james@satlantic.com) writes:

> I have a draw widget that I do a bunch of image/coastline plotting in.
> I am currently currently working on a tool that will let the user
> measure a target in the image, in pixels. The tool has a vernier which
> should open and close (imagine a C-clamp) and the tool should rotate.
> I have all the code in place with one exception; no user interface to
> the actions. I think I have two choices;
> 1) an additional base with four buttons on it:open,close,rotate
> clockwise, rotate counter clockwise.
> This should be relatively easy to implement, but it's not my first
> choice

Not bad. Since there are four actions here, I might try to
implement it by using the left and right buttons. For example,
the left button would be for opening/closing and the right button
for rotating clockwise/counterclockwise. When the user clicked
the left button in the draw widget and moved toward the top of
the draw widget I would close the clamp; if they moved toward
the bottom of the draw widget I would open the clamp. Similarly
for the right button. This way you could have direct interaction
with the actions without having to click another button to get
you into the correct "mode".

> 2) using the cursor keys to hook the actions. Unfortunately, I can't
> find any information on getting keyboard events in DrawWidgets -
> get_kbrd() just doesn't work until the widget is destroyed.

In general, you can't get keyboard events into draw widgets.
However, J.D. Smith at Cornell University came up with a
really clever idea for how this can be hacked by putting
a text widget behind your draw widget. I've saved J.D.'s
suggestions as a Widget Programming Tip on my web page.

http://www.dfanning.com/tips/keyboard_events.html

Cheers,

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL FAQ 4.04
Next Topic: Re: Embedding IDL visualization routines in C/C++ apps

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:07:34 PDT 2025

Total time taken to generate the page: 0.00600 seconds