comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Multiple Selection List Widget

Multiple Selection List Widget
type: item
description: Hi Folks, Deb Summa was looking for a multiple selection list widget the other day. I mentioned that there was no good way to implement such a thing in IDL, but there were hacks. Deb was kind enough to call that bluff, so here is a hack. :-) I don't pretend its elegant or the last word on selection widgets, but it took me an hour or so while I was waiting for the kids to get the movie started. I wrote the list selection part as a compound widget that has an Accept Selection button. Selecting or clicking items in the list toggles the item on or off. These events are "swallowed" by the compound widget. When you hit the Accept Selection button, the compound widget generates an anonymous structure event with an INDEX field. This field is a vector with as many elements as there are items in the list. A one indicates the item is selected, a zero indicates is is not selected. The program using the compound widget can do whatever it likes with the event. You can get and set the value of the list widget in the normal way. I've included a little TEST program at the bottom of the code to exercise the compound widget, named CW_MLIST. Simply compile this code and type "TEST" to run the program. The program has NO documentation (tired of writing), but it is pretty trivial so I think you will have no trouble understanding how it works. If I get a few minutes later on, I will probably write this up as a tip and put some documentation in it. :-) Cheers, David ****************************************************** PRO CW_MList_Cleanup, id ; Cleans up compound widget pointers. Widget_Control, id, Get_UValue=info, /No_Copy IF N_Elements(info) NE 0 THEN BEGIN Ptr_Free, info.value Ptr_Free, info.on ENDIF END;-------------------------------------------------- PRO CW_MList_Set, id, value ; Sets the value of the list widget. child = Widget_Info(id, /Child) Widget_Control, child, Get_UValue=info, /No_Copy value = ' ' + value *info.on = BytArr(N_Elements(value)) *info.value = value Widget_Con…
creator: davidf
date: 1998-01-23T08:00:00-00:00