Re: Widget_List question ... [message #12645] |
Mon, 10 August 1998 00:00  |
J.D. Smith
Messages: 214 Registered: August 1996
|
Senior Member |
|
|
David Fanning wrote:
>
> Darran (darran@my-dejanews.com) writes:
>
>> By initiating Widget_List without a value field, viz.
>>
>> list = widget_list(base)
>>
>> I obtain a list box with no selectable items - fine.
>> However, if I now add some elements to the listbox, it
>> doesn't seem possible to get back to this "null" state.
>> I've tried to get back to a null list via calls like
>>
>> widget_control, list, set_value=ptr_new()
>> widget_control, list, set_value=strarr(0)
>> widget_control, list, set_value=strarr()
>>
>> with no success. The following gives a selectable
>> blank:
>>
>> widget_control, list, set_value=''
>>
>> Since IDL doesn't allow one to query the value of
>> a widget_list, I cannot extract the initial value
>> and discover its type.
>
> It is not at all clear to me why you would WANT to
> be doing this, but how about this:
>
> Widget_Control, list, /Destroy
> list = Widget_List(base)
>
> Cheers,
>
> David
>
> P.S. Those of you who have heard me preach over and over
> to NEVER destroy a widget sub-hierarchy will be pleased
> to learn that "NEVER" means "almost NEVER". RSI assures
> me that you can get away with this behavior now in almost
> every case. I still cringe when I recommend it, but it
> has proven useful in several examples lately. :-)
>
I presume the reason he wants to return to the original state is that
all of the list elements have been removed. Imagine that a list of
items get added to the widget. They are then removed. Perhaps they
were put there by accident in the first place. In any case, our list is
now empty, but to reflect that in the widget all we can do is put a
selectable blank.
Does the destroy/rebuild method cause noticeable flashing as the widgets
are changed? Does sizing/placement get reevaluated, or does the widget
just occupy the position of the dead widget it is replacing?
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|