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

Home » Public Forums » archive » 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
Mouse and keyboard events in a draw widget [message #10544] Wed, 17 December 1997 00:00 Go to next message
James Albert is currently offline  James Albert
Messages: 4
Registered: September 1996
Junior Member
Hi
I'm new here, and fairly new to IDL programming. I have a problem,
which probably has an easy solution, but I can't find any references to
the problem area in the manuals. If anyone here can help me, I would be
most appreciative

Here's the bzz:

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
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

Any ideas?
--
James Albert
Programmer/Analyst
Satlantic Inc.
902-492-4780 (voice)
902-492-4781 (fax)
james@satlantic.com
Re: Mouse and keyboard events in a draw widget [message #10679 is a reply to message #10544] Thu, 18 December 1997 00:00 Go to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
James Albert wrote:
>
> 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
> 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

If you want to use method #2 then JD Smith's suggestion (on David's
IDL Tips page) would work very well.

One thing I have done in the past, when I wanted to have "buttons"
that allowed more than one action, was to create small draw widgets
and use XYOUTS to place a label in them, and then basically use
these draw widgets as buttons. This way, you can use the different
mouse buttons to do various things; LEFT click could be "rotate
clockwise", and RIGHT click could be "rotate counter-clockwise".

Of course, you can use your original draw widget for this as well,
as David Fanning suggests; it all depends what you want your
interface to look like. I usually like to have buttons (or "draw
buttons" in this case), or *something* there that gives the user a
clue what they have to do when they are looking at the interface
(means fewer times I have to explain to people how the damn thing
works!).

I have an example program using this technique if you're interested.

Dave
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: resizing draw widget
Next Topic: IDL verses other interpertative languages (tcl/tk, khouros, pv_wave, etc).

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

Current Time: Sat Oct 11 08:37:24 PDT 2025

Total time taken to generate the page: 1.28037 seconds