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