Re: variable # of widgets [message #8707] |
Fri, 18 April 1997 00:00 |
Dave Burridge
Messages: 5 Registered: April 1997
|
Junior Member |
|
|
David,
I agree with Tims suggestion. However, I would be tempted to use
WIDGET_BUTTON with /MENU keyword where necessary to break up the list.
This way, if you want to mount these options on the menubar or change
them in any way they're just buttons, and you can do what you like.
Someting like this:
buttonmenu = WIDGET_BUTTON (mymenu, VALUE='file data', /MENU)
day1menu = WIDGET_BUTTON (buttonmenu, VALUE='day 1', /MENU)
day1_1300 = WIDGET_BUTTON (day1menu, VALUE='13:00')
day1_1400 = WIDGET_BUTTON (day1menu, VALUE='14:00')
And so on. These can be killed with a straight WIDGET_CONTROL, /DESTROY
command (I wouldn't start trying to kill/add items to a realised menubar
though!).
Cheers,
Dave
Tim Patterson wrote:
>
> David wrote:
>>
>> Hi,
>>
>> Does anyone know how to make a pull down menu with a variable number of
>> selectable entries?
>>
>> I have a possible number of, say, 1 to 50 sensors. I want to read a file
>> containing the name of each sensor, place each name in a widget pull
>> down menu, and then when the user selects an entry from this menu, graph
>> the data from the corresponding sensor. Is this possible?
>>
>> Thanks in advance for any help!
>>
>> cheers!
>> David Katz
>
> It's possible, but might be the wrong approach. Having 50 items in
> a pull-down menu under X/Motif would mean that it would be very likely
> that some of the menu would disappear off screen.
>
> A better solution might be to read your names into a string
> array then use this to set up a scrollable List Widget from
> which the user can select the name required. You can change
> the contents of a list widget using the WIDGET_CONTROL procedure
> with SET_VALUE = my_string_array, or you can do this at the time
> you create the list widget.
>
> You can do the same thing with a droplist widget, of course, but
> as I said above, you may run into trouble.
>
> Hope this helps (and I understood the question properly)
>
> Tim
|
|
|
Re: variable # of widgets [message #8712 is a reply to message #8707] |
Thu, 17 April 1997 00:00  |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
David wrote:
>
> Hi,
>
> Does anyone know how to make a pull down menu with a variable number of
> selectable entries?
>
> I have a possible number of, say, 1 to 50 sensors. I want to read a file
> containing the name of each sensor, place each name in a widget pull
> down menu, and then when the user selects an entry from this menu, graph
> the data from the corresponding sensor. Is this possible?
>
> Thanks in advance for any help!
>
> cheers!
> David Katz
It's possible, but might be the wrong approach. Having 50 items in
a pull-down menu under X/Motif would mean that it would be very likely
that some of the menu would disappear off screen.
A better solution might be to read your names into a string
array then use this to set up a scrollable List Widget from
which the user can select the name required. You can change
the contents of a list widget using the WIDGET_CONTROL procedure
with SET_VALUE = my_string_array, or you can do this at the time
you create the list widget.
You can do the same thing with a droplist widget, of course, but
as I said above, you may run into trouble.
Hope this helps (and I understood the question properly)
Tim
|
|
|