Michael Asten wrote:
> pei zeng wrote:
>
>> Hi, Guys
>>
>> Does anybody know how to make a pulldown menu with multiple selections?
>>
>> Thanks!
>>
>> pei
>
> I did it using the pull down menu generated by the idl5.2 GuiBuilder,
> with
> subsequent addition to code to extract the "multiple" selection.
> Attached is a demo example - the task is to select multiple 'loops'
> from
> the left column of a widget, and single 'line' and 'component' from 2nd
> and
> 3rd columns of the widget.
Dear Michael,
this is a bit more modern code of your widget.
The arrangement of the widget was done by the GUI Builder too. An important
difference to your code is
thats the ids of the widget function are organized in a structure which is
the uvalue of the main base.
I am prefering pointer instead of a common block.
Unfortunately this was not the answer of the question.
Regards
R.Bauer
PRO list_ex_event, Event
WIDGET_CONTROL,event.top,get_uvalue=map
CASE event.id OF
(*map).id_show: BEGIN
idx=WIDGET_INFO((*map).id_list,/list_select)
PRINT,(*map).data.list_value[idx]
END
(*map).id_done: WIDGET_CONTROL,event.top,/destroy
ELSE:
ENDCASE
END
PRO list_ex
map=CREATE_STRUCT('id_base_0',WIDGET_BASE(SCR_XSIZE=300 ,SCR_YSIZE=200 ,$
TITLE='list example' ,SPACE=3 ,XPAD=3 ,YPAD=3))
value=['alpha','beta','gamma','delta']
map=CREATE_STRUCT(map,'id_list',WIDGET_LIST(map.id_base_0, Uvalue='LIST'
,$
XOFFSET=9 ,YOFFSET=10 ,SCR_XSIZE=118 ,SCR_YSIZE=138 ,XSIZE=11
,YSIZE=2,$
value=value,/multiple))
map=CREATE_STRUCT(map,'id_show', WIDGET_BUTTON(map.id_base_0,
Uvalue='SHOW', $
XOFFSET=151 ,YOFFSET=18 ,/ALIGN_CENTER ,VALUE='SHOW'))
map=CREATE_STRUCT(map,'id_done', WIDGET_BUTTON(map.id_base_0,
Uvalue='DONE', $
XOFFSET=151 ,YOFFSET=48 ,/ALIGN_CENTER ,VALUE='DONE'))
map=CREATE_STRUCT(map,'Data',CREATE_STRUCT('list_value',valu e))
map=PTR_NEW(TEMPORARY(map))
WIDGET_CONTROL, /REALIZE, (*map).id_BASE_0,set_uvalue=map
XMANAGER, 'list_ex', (*map).id_BASE_0
ptr_free,map
END
|