comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: pulldown menu with multiple selections - Yes we can!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: pulldown menu with multiple selections - Yes we can! [message #17538] Fri, 29 October 1999 00:00 Go to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:

> Since I feel I stepped over the forbidden line here, the only way I can
> save the situation is to buy David a beer when I am in Ft. Collins :-)

Oh, well, alright then. We'll tip back a few Fat Tires,
the Fort's Finest. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: pulldown menu with multiple selections - Yes we can! [message #17539 is a reply to message #17538] Fri, 29 October 1999 00:00 Go to previous messageGo to next message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
Hi David,

Why in the world did you think I meant YOU when I said "old-fashioned"?
Do you think I'd dare putting my humble IDLing next to yours? I am an
amateur, and I admit to that readily :-)
Lets just say that I feel "old-fashioned" in that I don't like
deciphering machine-generated code trying to figure out what did it do
and why. It takes me less time to write it all myself knowing already
what it is going to be like. And I not only look for my glasses in the
meantime but have to clean them to see the code, too :-)

Since I feel I stepped over the forbidden line here, the only way I can
save the situation is to buy David a beer when I am in Ft. Collins :-)

Cheers,
Pavel

> P.S. I would have hardly thought that anyone who spends
> as much time as I do advocating object-oriented programming
> techniques would be considered "old-fashioned", but there
> you have it. The world has probably moved on to "telepathically
> inspired coding" during the time I was still looking for
> my damn glasses. Old fashioned, indeed. :-(
Re: pulldown menu with multiple selections - Yes we can! [message #17543 is a reply to message #17538] Fri, 29 October 1999 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel Romashkin (promashkin@cmdl.noaa.gov) writes:

> I am afraid I am admitting that I belong to the "old-fashioned"
> category of IDLers

Now hold on there. Them's fightin' words where I come from. :-)

Cheers,

David

P.S. I would have hardly thought that anyone who spends
as much time as I do advocating object-oriented programming
techniques would be considered "old-fashioned", but there
you have it. The world has probably moved on to "telepathically
inspired coding" during the time I was still looking for
my damn glasses. Old fashioned, indeed. :-(

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: pulldown menu with multiple selections - Yes we can! [message #17544 is a reply to message #17538] Fri, 29 October 1999 00:00 Go to previous messageGo to next message
Pavel Romashkin is currently offline  Pavel Romashkin
Messages: 166
Registered: April 1999
Senior Member
> While I'm not sure your post sheds much light on the
> original question, it does, however, nicely illustrate
> some previous points I made about the code generated
> by the Widget Builder. :-)

Oh no. Is that what it looks like? I have never used it and I am afraid now I
am glad I have not. For what I am doing, I'd have WID_BASE_1023 by now
probably and would never been able to figure out what is going on :-( Also,
isn't explicit widget sizing considered unethical for cross-platform porting?
I discovered that half of my widgets are hiding behind the others if I use
sizing that's nice on UNIX and try to run the code on a PC :-( I guess
GUI-Builder is not too considerate in this respect.

I am afraid I am admitting that I belong to the "old-fashioned" category of
IDLers despite the fact I started in it not so long ago. I really like to
understand what is happening in my code.

Cheers,
Pavel
Re: pulldown menu with multiple selections - Yes we can! [message #17554 is a reply to message #17538] Fri, 29 October 1999 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Michael Asten (masten@mail.earth.monash.edu.au) writes:

>> Does anybody know how to make a pulldown menu with multiple selections?
>
> 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.

Uh, thanks for this, Michael. But I don't see a pull-down
menu anywhere. I see lots of lists. :-)

While I'm not sure your post sheds much light on the
original question, it does, however, nicely illustrate
some previous points I made about the code generated
by the Widget Builder. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: pulldown menu with multiple selections - Yes we can! [message #17558 is a reply to message #17538] Fri, 29 October 1999 00:00 Go to previous messageGo to next message
Michael Asten is currently offline  Michael Asten
Messages: 53
Registered: March 1999
Member
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.

On win95/98/NT systems, multiple menu item selection is by the windows
convention of pressing <control> rightMouseClick to select individual
items
additively, or pressing <shift> rightMouseClick to select all menu items
between two highlighted items. I assume Mac and Unix have mouse
conventions for equivalent processes.

I acknowledge the help of RSI Tech support in getting this multiple menu
item selection working - it is not well documented in the idl5.2 online
help.

Regards,
Michael Asten

Code follows:

;
; IDL Widget Interface Procedures. This Code is automatically
; generated and should not be modified.

;
; Generated on: 12/10/98 13:43.49
;
PRO WID_BASE_0_event, anEvent
common
select_subs,loop_index,line_index,comp_index,freq_index,gain _index

_widID_ = anEvent.top

CASE anEvent.id OF

WIDGET_INFO(_widID_, FIND_BY_UNAME='WID_LIST_3'): BEGIN
if TAG_NAMES(anEvent, /STRUCTURE_NAME) EQ 'WIDGET_LIST' then $
Freq_index= anEvent.index
END
WIDGET_INFO(_widID_, FIND_BY_UNAME='WID_LIST_4'): BEGIN
if TAG_NAMES(anEvent, /STRUCTURE_NAME) EQ 'WIDGET_LIST' then $
Gain_index= anEvent.index
END
WIDGET_INFO(_widID_, FIND_BY_UNAME='WID_LIST_1'): BEGIN
if TAG_NAMES(anEvent, /STRUCTURE_NAME) EQ 'WIDGET_LIST' then $
Line_index= anEvent.index
END
WIDGET_INFO(_widID_, FIND_BY_UNAME='WID_LIST_2'): BEGIN
if TAG_NAMES(anEvent, /STRUCTURE_NAME) EQ 'WIDGET_LIST' then $
Comp_index= anEvent.index
END
WIDGET_INFO(_widID_, FIND_BY_UNAME='WID_LIST_0'): BEGIN

; PROCESSING OF LIST SELECTION FOR LEFT COLUMN,
; WHERE MULTIPLE SELECTION REQUIRED
; need a second call to widget_info, to save name of wid
wid = widget_info(_widID_, FIND_BY_UNAME='WID_LIST_0')
; wid now contains the widget id of WID_LIST_0
print,'wid = ', wid
if TAG_NAMES(anEvent, /STRUCTURE_NAME) EQ 'WIDGET_LIST' then begin
;now get the indices of the selected list items
; this is a scalar, if only 1 choice made
; this is an array if multiple choices selected
loop_index=widget_info(wid,/list_select)
;print,'anEvent.index=',anEvent.index
;loop_index= anEvent.index
print,'loop_index from multiple select=',loop_index
endif
END

WIDGET_INFO(_widID_, FIND_BY_UNAME='WID_BUTTON_0'): BEGIN
if TAG_NAMES(anEvent, /STRUCTURE_NAME) EQ 'WIDGET_BUTTON' then $
widget_control,anEvent.top,/destroy
END
ELSE:
ENDCASE

END

PRO WID_BASE_0, GROUP_LEADER=_VWBGroup_, _EXTRA=_VWBExtra_
,loops,lines,comps,freqs,gains

;delete this - not neede for simple demo program
;RESOLVE_ROUTINE, 'select_subset2_eventcb' ; Load event callback
routines

WID_BASE_0 = WIDGET_BASE( GROUP_LEADER=_VWBGroup_, $
UNAME='WID_BASE_0' ,SCR_XSIZE=491 ,SCR_YSIZE=175 ,TITLE='IDL' $
,SPACE=3 ,XPAD=3 ,YPAD=3)


WID_LIST_2 = WIDGET_LIST(WID_BASE_0, UNAME='WID_LIST_2' $
,XOFFSET=180 ,YOFFSET=43 ,SCR_XSIZE=57 ,SCR_YSIZE=78,value=comps)


WID_LIST_3 = WIDGET_LIST(WID_BASE_0, UNAME='WID_LIST_3' $
,XOFFSET=254 ,YOFFSET=43 ,SCR_XSIZE=57 ,SCR_YSIZE=78,value=freqs)


WID_LIST_4 = WIDGET_LIST(WID_BASE_0, UNAME='WID_LIST_4' $
,XOFFSET=337 ,YOFFSET=43 ,SCR_XSIZE=57 ,SCR_YSIZE=78,value=gains)


WID_LABEL_0 = WIDGET_LABEL(WID_BASE_0, UNAME='WID_LABEL_0' $
,XOFFSET=38 ,YOFFSET=20 ,/ALIGN_LEFT ,VALUE='LOOP')


WID_LABEL_4 = WIDGET_LABEL(WID_BASE_0, UNAME='WID_LABEL_4' $
,XOFFSET=365 ,YOFFSET=20 ,SCR_XSIZE=28 ,SCR_YSIZE=18 $
,/ALIGN_LEFT ,VALUE='GAIN')


WID_LABEL_3 = WIDGET_LABEL(WID_BASE_0, UNAME='WID_LABEL_3' $
,XOFFSET=276 ,YOFFSET=20 ,/ALIGN_LEFT ,VALUE='FREQ')


WID_LABEL_1 = WIDGET_LABEL(WID_BASE_0, UNAME='WID_LABEL_1' $
,XOFFSET=100 ,YOFFSET=20 ,SCR_XSIZE=62 ,SCR_YSIZE=18 $
,/ALIGN_LEFT ,VALUE='LINE/HOLE')


WID_LIST_1 = WIDGET_LIST(WID_BASE_0, UNAME='WID_LIST_1' $
,XOFFSET=103 ,YOFFSET=43 ,SCR_XSIZE=57 ,SCR_YSIZE=78,value=lines)


WID_LABEL_2 = WIDGET_LABEL(WID_BASE_0, UNAME='WID_LABEL_2' $
,XOFFSET=205 ,YOFFSET=20 ,/ALIGN_LEFT ,VALUE='COMPNT')


WID_BUTTON_0 = WIDGET_BUTTON(WID_BASE_0, UNAME='WID_BUTTON_0' $
,XOFFSET=418 ,YOFFSET=43 ,/ALIGN_CENTER ,VALUE='APPLY')


WID_LIST_0 = WIDGET_LIST(WID_BASE_0, UNAME='WID_LIST_0' ,XOFFSET=18 $
,YOFFSET=44 ,SCR_XSIZE=43 ,SCR_YSIZE=78 ,/multiple,value=loops)

WIDGET_CONTROL, /REALIZE, WID_BASE_0

XMANAGER, 'WID_BASE_0', WID_BASE_0

END
;
; Empty stub procedure used for autoloading.
;
PRO select_subset2, GROUP_LEADER=_VWBGroup_, _EXTRA=_VWBExtra_
,loops,lines,comps,freqs,gains
WID_BASE_0, GROUP_LEADER=_VWBGroup_, _EXTRA=_VWBExtra_
,loops,lines,comps,freqs,gains
END

; MAIN PROG
common
select_subs,loop_index,line_index,comp_index,freq_index,gain _index
loops=['loop1','loop2','loop3','loop4','loop5']
lines=['line1','line2']
comps=['Z']
freqs=['P6.25']
gains=['0']
loop_index=0 & line_index=0 & comp_index=0 & freq_index=0 & gain_index=0
select_subset2 ,loops,lines,comps,freqs,gains
print,loop_index,line_index,comp_index,freq_index,gain_index
end
Re: pulldown menu with multiple selections - Yes we can! [message #17595 is a reply to message #17558] Tue, 02 November 1999 00:00 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
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
Re: pulldown menu with multiple selections - Yes we can! [message #17596 is a reply to message #17538] Tue, 02 November 1999 00:00 Go to previous messageGo to next message
Michael Asten is currently offline  Michael Asten
Messages: 53
Registered: March 1999
Member
Pavel Romashkin wrote:

>> While I'm not sure your post sheds much light on the
>> original question, it does, however, nicely illustrate
>> some previous points I made about the code generated
>> by the Widget Builder. :-)
>
> Oh no. Is that what it looks like? I have never used it and I am afraid now I
> am glad I have not. For what I am doing, I'd have WID_BASE_1023 by now
> probably and would never been able to figure out what is going on :-(

Only if you choose to accept the machine-nominated name. You can nominate an
alternative name while building the gui if you wish - and you make a strong case
for doing so. Sorry if my micky mouse eg confused the issue.

Regards,
Michael Asten
Re: pulldown menu with multiple selections - Yes we can! [message #17597 is a reply to message #17538] Tue, 02 November 1999 00:00 Go to previous messageGo to next message
Michael Asten is currently offline  Michael Asten
Messages: 53
Registered: March 1999
Member
David Fanning wrote:umns of the widget.

>
> Uh, thanks for this, Michael. But I don't see a pull-down
> menu anywhere. I see lots of lists. :-)
>

Oops. Granted. Yes, I failed to point out that the solution posted is indeed
a set of lists, rather than literal pull-down menus. However the lists ARE
scrollable, ie a list of any length can be displayed in a box of a lesser
number of rows (theoretically can do it with one row, but its asthetically
easier to make selections if the list box is minimum 3 rows long). The
difference in user-feel between a pulldown list and scrollable lists as
described is minor, and the multiple-selection scrollable list provides a
viable solution to a real problem I encountered. Its just possible it might
also be a solution for other users with multiple-selection needs. It certainly
does not depend on use of the GuiBuilder to implement it - but I have a kinky
philosophy whereby I prefer to avoid programming in Assembly language if
Fortran is available.

Regards,
Michael Asten
Re: pulldown menu with multiple selections - Yes we can! [message #17709 is a reply to message #17538] Tue, 09 November 1999 00:00 Go to previous message
Michael Asten is currently offline  Michael Asten
Messages: 53
Registered: March 1999
Member
"R.Bauer" wrote:

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

But an illuminating example of how to improve. Thanks for the tip.
Regards,
Michael Asten
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Bounding Box in IDL postscript output
Next Topic: CGM files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:45:44 PDT 2025

Total time taken to generate the page: 0.00535 seconds