;------------------------------------------------------------- ;+ ; NAME: ; CW_DROPLIST2 ; PURPOSE: ; A pop up list from which to select an item. ; CATEGORY: ; CALLING SEQUENCE: ; wid = cw_droplist2( parent) ; INPUTS: ; parent = Widget ID of parent widget. in ; KEYWORD PARAMETERS: ; Keywords: ; VALUE=list Given text array with list of items. ; NUM=num Number to display before breaking list (def=15). ; UVALUE=uval User value that may be set. ; /UPDATE means update button with selected item. ; Otherwise button not updated except using ; cw_droplist2_select, id, indx ; OUTPUTS: ; wid = Widget ID of opo up list. out ; COMMON BLOCKS: ; NOTES: ; Note: You can set a new droplist using ; widget_control, id, set_value=list ; and get the current list using ; widget_control, id, get_value=list ; but to set the value displayed on the button you must do ; cw_droplist2_select, id, indx ; where indx is the index in the list to display. ; Use /UPDATE to avoid this extra call. ; MODIFICATION HISTORY: ; R. Sterner, 2001 Dec 07 ; ; Copyright (C) 2001, Johns Hopkins University/Applied Physics Laboratory ; This software may be used, copied, or redistributed as long as it is not ; sold and this copyright notice is reproduced on each copy made. This ; routine is provided as is without any express or implied warranties ; whatsoever. Other limitations apply as described in the file disclaimer.txt. ;- ;------------------------------------------------------------- ;---------------------------------------------------------------------- ; Select displayed item for cw_droplist2. ;---------------------------------------------------------------------- pro cw_droplist2_select, id, indx chld = widget_info(id, /child) ; First child widget. widget_control, chld, get_uval=s ; Grab state info from child. value = *s.p_value mx = n_elements(value)-1 widget_control, chld, set_value=value(indx