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

Home » Public Forums » archive » Re: IDL listbox
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL listbox [message #23730] Fri, 16 February 2001 03:13 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Rick Towler wrote:
>
> Maybe I am not understanding you. You just want to get the selected items
> from a listbox?
>
> say you have a list widget "info.wFilesList"
>
> Keep a pointer to a string array of items contained in that list (they must
> be in order from top to bottom). I use a pointer because I need to
> dynamically resize the array, you might be able to get away with just an
> array.
>
> I can then poll widget_info while setting /list_select for the currently
> selected items in my list. This will "return the index or indices of the
> currently-selected (highlighted) element or elements in the specified list
> widget. Note that this offset is zero-based. If no element is currently
> selected, -1 is returned."
>
> selected = widget_info(info.wFilesList, /list_select)
>
> You can then use the indices to subscript your array of items.
>
> One would think that you could get a string array of either the selected
> items or all items contained in a widget_list but as far as I can tell you
> only can get the indices. If anyone knows how to do this, please speak up!
>
> Hope this helps.
>
> -Rick Towler
>
> "Stuart Norton" <stuart@isis.ucolick.org> wrote in message
> news:Pine.GSO.4.03.10102151649520.125-100000@isis.ucolick.or g...
>>
>> 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 ---
>> ------------------------------------------------------------ ----------
>>

... as David seems to be out of reach, let me take this and advise you
to buy his excellent book! The main idea is to use the widget UValue
to store that string list in what David calls an "info structure". The
UValue can then be retrieved with WIDGET_CONTROL (o rwas it
WIDGET_INFO?) in your event handling routine, and you can then access
the selected items the way Stuart mentions. But, please, never use an
array fo rthese strings; you almost certainly will have to change that
size somewhere, and you are guaranteed to get into trouble if you
don't start using pointers right away. And they are really not that
hard to use (there were some discussions on them last year on this
newsgroup, maybe you can browse www.deja.com to find them).

Best regards,

Martin

--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[ [[[[[[[
[Message index]
 
Read Message
Read Message
Previous Topic: Re: problems with EMF file format
Next Topic: Read and Write IDL SAVE files!

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

Current Time: Wed Oct 08 19:02:39 PDT 2025

Total time taken to generate the page: 0.00386 seconds