pro select_tool,list_items,selected_items,title=title ;=============================================================================== ; Program: select_tool ; ; Version: 2.0 ; ; Date: March 2004 ; ; Purpose/Function: ; This procedure creates a list selection GUI ; and returns the indices of the selected list items ; ; Parameters: ; input list_items strarr items to display in selection list ; output selected_items intarr indices of list items chosen ; ; Keywords: ; title string title/prompt string for the GUI ; ; Invocation: idl> select_tool, parameter_list,index_list ; ; ; Language/Compiler Version: ; This routine has been tested on the systems listed below. ; Computer Operating System IDL Version ; --------------- ---------------- ----------- ; PC Windows 2000 6.0 ; ; ; Updates: generalized to make it a useful utility GUI item, cleaned up ; code and logic ; ;=============================================================================== common selectblock,selected ; create a GUI base base = widget_base(/column,title=title) ; create function buttons buttonBase = widget_base(base,/ROW) b1 = widget_button(buttonBase,value='Select All',UVALUE="selectall") b2 = widget_button(buttonBase,value='Help',UVALUE="help") b3 = widget_button(buttonBase,value='Selection Complete',UVALUE="complete") ; create the selection list listBase = widget_base(base,/row) listID = widget_list(listBase,value=list_items,ysize=20,/multiple,UVALUE="list") widget_control,base,/realize ; initialize the state structure state={listID:listID} widget_control,base,set_uvalue=state xmanager,'select_tool',base ; control returns here when GUI is destroyed selected_items = selected return end