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

Home » Public Forums » archive » IDL listbox
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
IDL listbox [message #23735] Thu, 15 February 2001 17:00 Go to next message
Stuart Norton is currently offline  Stuart Norton
Messages: 3
Registered: February 2001
Junior Member
Sorry if this is an obvious one, but I've been trying for too long now...

How do you get a list of all selected items from a widget_listbox? I have
a listbox which I want to handle multiple selections. I was originally
going to use the event handler: just toggle the settings of each item
which was clicked... but (at least in Unix) when you single click without
holding shift or control, all previous selections in a listbox are
de-selected. I don't know how to keep track of which items are
de-selected like this. (There doesn't seem to be an event for that.)

Another possibility was the OnSelectValue parameter to widget_listbox; I
created a procedure to remember if any given item was selected, but
again I have the problem that de-selection is not handled.

There ought to be an easy way, say from widget_control, to return an array
of indices which are selected at the moment, or something like that. Why
can't I find such a thing??

Thanks in advance,
Stuart

------------------------------------------------------------ ----------
--- Stuart Norton ---
--- stuart@ucolick.org ---
--- Astronomy & Astrophysics - University of California ---
--- Santa Cruz, CA 95064 ---
--- (831) 459-4362 ---
------------------------------------------------------------ ----------
Re: IDL listbox [message #23816 is a reply to message #23735] Sat, 17 February 2001 00:38 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Stuart Norton (stuart@isis.ucolick.org) writes:

> (BTW, I am already the proud owner of one copy - wait, no, two copies - of
> IDL Programming Techniques! Is it possible the answer wasn't in there?...
> Nah, I must have missed it. ;-)

Well, I'm sure it will be in the *next* version. Shall
I reserve you a copy, Stuart. :-)

Cheers (and many thanks!)

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: IDL listbox [message #23819 is a reply to message #23735] Fri, 16 February 2001 15:18 Go to previous message
Stuart Norton is currently offline  Stuart Norton
Messages: 3
Registered: February 2001
Junior Member
Thanks to all who replied. widget_info was the key I needed!

(BTW, I am already the proud owner of one copy - wait, no, two copies - of
IDL Programming Techniques! Is it possible the answer wasn't in there?...
Nah, I must have missed it. ;-)

Stuart


On Fri, 16 Feb 2001, JD Smith wrote:

> Stuart Norton wrote:
>>
>> Sorry if this is an obvious one, but I've been trying for too long now...
>>
>> How do you get a list of all selected items from a widget_listbox? I have
>> a listbox which I want to handle multiple selections. I was originally
>> going to use the event handler: just toggle the settings of each item
>> which was clicked... but (at least in Unix) when you single click without
>> holding shift or control, all previous selections in a listbox are
>> de-selected. I don't know how to keep track of which items are
>> de-selected like this. (There doesn't seem to be an event for that.)
>>
>> Another possibility was the OnSelectValue parameter to widget_listbox; I
>> created a procedure to remember if any given item was selected, but
>> again I have the problem that de-selection is not handled.
>>
>> There ought to be an easy way, say from widget_control, to return an array
>> of indices which are selected at the moment, or something like that. Why
>> can't I find such a thing??
>
>
> This is starting to be the #2 all-time FAQ, after color decomposition,
> of course. For whatever inane reasons (most likely because the
> functionality was added only a few releases ago), getting the indices of
> multiply selected list widgets requires a visit to our friend
> widget_info:
>
> list=widget_info(self.list,/LIST_SELECT)
>
> Now, why this functionality is here instead of
>
> widget_control,self.list,get_value=list
>
> it's best not to ask. If you want the items on the list themselves,
> you'll have to store them somewhere for access.
>
> JD
>
>

------------------------------------------------------------ ----------
--- Stuart Norton ---
--- stuart@ucolick.org ---
--- Astronomy & Astrophysics - University of California ---
--- Santa Cruz, CA 95064 ---
--- (831) 459-4362 ---
------------------------------------------------------------ ----------
Re: IDL listbox [message #23822 is a reply to message #23735] Fri, 16 February 2001 09:04 Go to previous message
John-David T. Smith is currently offline  John-David T. Smith
Messages: 384
Registered: January 2000
Senior Member
Stuart Norton wrote:
>
> Sorry if this is an obvious one, but I've been trying for too long now...
>
> How do you get a list of all selected items from a widget_listbox? I have
> a listbox which I want to handle multiple selections. I was originally
> going to use the event handler: just toggle the settings of each item
> which was clicked... but (at least in Unix) when you single click without
> holding shift or control, all previous selections in a listbox are
> de-selected. I don't know how to keep track of which items are
> de-selected like this. (There doesn't seem to be an event for that.)
>
> Another possibility was the OnSelectValue parameter to widget_listbox; I
> created a procedure to remember if any given item was selected, but
> again I have the problem that de-selection is not handled.
>
> There ought to be an easy way, say from widget_control, to return an array
> of indices which are selected at the moment, or something like that. Why
> can't I find such a thing??


This is starting to be the #2 all-time FAQ, after color decomposition,
of course. For whatever inane reasons (most likely because the
functionality was added only a few releases ago), getting the indices of
multiply selected list widgets requires a visit to our friend
widget_info:

list=widget_info(self.list,/LIST_SELECT)

Now, why this functionality is here instead of

widget_control,self.list,get_value=list

it's best not to ask. If you want the items on the list themselves,
you'll have to store them somewhere for access.

JD
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: VRML file importer?
Next Topic: Back to idl after a looong time...

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

Current Time: Mon Dec 01 06:20:30 PST 2025

Total time taken to generate the page: 1.12108 seconds