Re: Strange widget question [message #13950] |
Mon, 21 December 1998 00:00 |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
Dyer Lytle wrote:
>
> Hi all,
>
> I am trying to use pull-down menus in a way for which they
> were never intended and am failing miserably. I have a draw
> widget containing text areas and I want the user to easily change
> the text in any particular area by clicking on that area and having
> a menu of possible values pop up any one of which could be selected
> by moving the mouse to it and releasing the mouse button.
>
> The way I tried to do this was to use a bulletin-board base with
> pull-down
> menu buttons hiding under the draw widget. Then when the user
> clicks on the draw widget, I catch the event, decide which pull-down
> menu I need and send an event to the appropriate button. I haven't
> been able to activate the menu this way. How do I tell a button to
> push itself? Any one have an alternative way to do this?
>
> I know I can just pop up a new widget with a list and have the user
> click on
> the value but I was hoping to make the user-interface as simple
> as possible.
>
> Thanks,
>
> -Dyer Lytle in Tucson
I think an easy way to handle this is to map regions of the draw
widget to your various lists (which you probably have already done).
Then use the EVENT.X and EVENT.Y elements of the draw widget
event structure to determine which list you want to pop up.
You can use POLYFILLV() to get lists of indices for the regions
of the draw widget. In your event handler you can convert EVENT.X
and EVENT.Y to a one-dimensional coordinate using:
index = (event.y * dimX) + event.x
and search the lists of indices for this index. (dimX is the
X dimension of the draw widget)
For the lists, I would do as Martin Schultz suggests and use list
widgets, and have the user select the appropriate element. If speed
becomes an issue, you can create the list widgets at the start and
unmap them, and just position-and-unmap them as needed.
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|
Re: Strange widget question [message #13956 is a reply to message #13950] |
Mon, 21 December 1998 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Dyer Lytle wrote:
> Hi all,
>
> I am trying to use pull-down menus in a way for which they
> were never intended and am failing miserably. I have a draw
> widget containing text areas and I want the user to easily change
> the text in any particular area by clicking on that area and having
> a menu of possible values pop up any one of which could be selected
> by moving the mouse to it and releasing the mouse button.
>
> The way I tried to do this was to use a bulletin-board base with
> pull-down
> menu buttons hiding under the draw widget. Then when the user
> clicks on the draw widget, I catch the event, decide which pull-down
> menu I need and send an event to the appropriate button. I haven't
> been able to activate the menu this way. How do I tell a button to
> push itself? Any one have an alternative way to do this?
>
> I know I can just pop up a new widget with a list and have the user
> click on
> the value but I was hoping to make the user-interface as simple
> as possible.
>
> Thanks,
>
> -Dyer Lytle in Tucson
haven't tried it, but how about a list box instead of a dropdown menu?
Martin
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
|
|
|
Re: Strange widget question [message #13964 is a reply to message #13950] |
Sat, 19 December 1998 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Dyer Lytle (dyer@lpl.arizona.edu) writes:
> I am trying to use pull-down menus in a way for which they
> were never intended and am failing miserably. I have a draw
> widget containing text areas and I want the user to easily change
> the text in any particular area by clicking on that area and having
> a menu of possible values pop up any one of which could be selected
> by moving the mouse to it and releasing the mouse button.
>
> The way I tried to do this was to use a bulletin-board base with
> pull-down
> menu buttons hiding under the draw widget. Then when the user
> clicks on the draw widget, I catch the event, decide which pull-down
> menu I need and send an event to the appropriate button. I haven't
> been able to activate the menu this way. How do I tell a button to
> push itself? Any one have an alternative way to do this?
If I understand this question correctly you want to send
an event to the root of the pull-down menu so that
the pull-down menu is display (pulled down). Is that
correct?
If so, I think you are completely out of luck. Menu
buttons (any button in the menu bar or buttons with the
MENU keyword set for them don't generate events and
can't respond to events that are sent to them. (You
can send events to widgets with WIDGET_CONTROL and
the SEND_EVENT keyword.) The response of a pull-down
menu button is entirely window manager driven and has
nothing to do with anything you can control in IDL.
Of course, it is entirely possible to have a pull-down
menu button *appear* when you click in the draw widget.
But the user will have to click on the button to display
the menu themselves. (I used to be fond of this "hidden
menu" technique, but for some reason it's fallen out of
favor with me. I used to like to pop-up the pull-down
menu right under where the user clicked.)
Cheers,
David
P.S. Just as an aside, I am suppose to be in the
Tucson area in January teaching the programming techniques
that I favor most *these* days. We have room for a few more
people in this class, if you are interested. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Progamming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|