Re: Droplist Widgets: set initial value??? [message #8074] |
Tue, 04 February 1997 00:00 |
Robert Moss
Messages: 74 Registered: February 1996
|
Member |
|
|
Michel wrote:
>
> Hi all,
> I have a question concerning droplist widgets. Is it possible to set the
> active button of a droplist widget? The problem is, that I have a user
> menu containing a droplist widget (and some more); the user leave the
> dialog using the <ok> or the <cancel> button. But if the value of the
> droplist widget was changed and the <cancel> button is pressed, I would
> like to restore the old setting. Is this possible, or have I to use another
> widget?
>
> Michel
widget_control, droplist_widget_id, set_droplist_select = index
where index is the index of the droplist you want selected. See the
online help for WIDGET_CONTROL.
--
Robert M. Moss, Ph.D. - mossrm@texaco.com - FAX (713)954-6911
------------------------------------------------------------ -----
This does not necessarily reflect the opinions of Texaco Inc.
|
|
|
Re: Droplist Widgets: set initial value??? [message #8080 is a reply to message #8074] |
Tue, 04 February 1997 00:00  |
Runar J|rgensen
Messages: 6 Registered: December 1995
|
Junior Member |
|
|
Michel wrote:
>
> Hi all,
> I have a question concerning droplist widgets. Is it possible to set the
> active button of a droplist widget?
No problem! :-)
Assume you have a droplist like this:
tlb=widget_base()
items=['Cancel','OK']
droplist=widget_droplist(tlb, value=items, uvalue=items,
event_pro='droplist_Event')
widget_control,tlb,/realize
; What index does 'OK' have
indx = where(items EQ 'OK')
;;; This is BAD, because where returns a lonarr and you need a single
value
; Set the current value in the droplist
widget_control,stations_list,set_droplist_select=indx(0)
What can be tricky is to obtain the right droplist ID. Use the
widget_info (with the parent, child, sibling or whatever keyword)
function for this.
Enjoy!
Runar
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
Runar Jorgensen ||
University of Oslo || Phone: +47 2285 5664
Department of Physics || Telefax: +47 2285 5671
P.O.Box 1048 Blindern || email: runar.jorgensen@fys.uio.no
0313 Oslo; Norway ||
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -=-=-=-=-=-=-=-
|
|
|