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