Re: Hiding a widget [message #10631] |
Fri, 02 January 1998 00:00 |
David Foster
Messages: 341 Registered: January 1996
|
Senior Member |
|
|
David Fanning wrote:
>
> Dale Gary (dgary@umbra.njit.edu) writes:
>
>> I was experimenting with the MAP keyword in widget programming and it
>> did not do quite
>> what I wanted. Perhaps someone can tell me if there is a better way. I
>> create a widget heirarchy,
>> then in response to a menu event I "hide" one of the widgets by using
>> WIDGET_CONTROL,widgetID,MAP=0
>> and the widget gratifyingly disappears. Unfortunately, I expected my
>> dynamically sized base widget,
>> which holds the hidden widget, to now shrink but instead there is just a
>> big gaping hole where the
>> hidden widget is. In other words, the sizing of the base widget still
>> takes into account the hidden
>> widget.
>>
>> What I want, I guess, is to remove the widget entirely from the
>> heirarchy, but I cannot find information
>> on how to do that. Does anyone have a simple technique short of
>> rebuilding the entire heirarchy from
>> scratch?
Don't know if this will be useful for your application, but you can
overlay widgets and groups of widgets. A good example of this is the
IDL procedure $IDL_DIR/lib/SLICER.PRO. The section that illustrates
this begins with:
junk = WIDGET_BASE(lbase, /FRAME, /COLUMN)
mode_base = WIDGET_BASE(junk) ;For the mode dependent bases
for i=0,nmodes-1 do $
if i ne 2 then $
sl.mode_bases[i] = WIDGET_BASE(mode_base, uvalue=0L, /COLUMN)
and then for each widget group that you want as an overlay you say:
parent = sl.mode_bases[0] ; slices mode
and then you buid this widget group using PARENT as the widget base ID.
At the very least, you could make a widget "disappear" by overlaying
it with something else, maybe a blank label widget.
However, if you are just trying to make the widget unavailable to the
user, then you should follow David Fanning's advice and use the
/SENSITIVE and SENSITIVE=0 keyword instead.
Dave
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
|
|
|
Re: Hiding a widget [message #10645 is a reply to message #10631] |
Tue, 23 December 1997 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Dale Gary (dgary@umbra.njit.edu) writes:
> I was experimenting with the MAP keyword in widget programming and it
> did not do quite
> what I wanted. Perhaps someone can tell me if there is a better way. I
> create a widget heirarchy,
> then in response to a menu event I "hide" one of the widgets by using
> WIDGET_CONTROL,widgetID,MAP=0
> and the widget gratifyingly disappears. Unfortunately, I expected my
> dynamically sized base widget,
> which holds the hidden widget, to now shrink but instead there is just a
> big gaping hole where the
> hidden widget is. In other words, the sizing of the base widget still
> takes into account the hidden
> widget.
>
> What I want, I guess, is to remove the widget entirely from the
> heirarchy, but I cannot find information
> on how to do that. Does anyone have a simple technique short of
> rebuilding the entire heirarchy from
> scratch?
It is not a good idea to destroy and re-create portions of
a widget hierarchy, although I believe you can get away with
it on some operating systems. (X systems seem to have the most
trouble with it.) As a general rule, to do what you want to
do you should rebuild the entire hierarchy from scratch.
Mapping and unmapping widgets is usually reserved for
mapping different widget hierarchies into the same
space in a bulletin board base (one that does neither the
COLUMN or ROW keyword set for it). See, for example, XLoadCT
as an excellent example.
If there are times when you want widgets to be inactive in
your program, most people make them insensitive/sensitive
using the SENSITIVE keyword. This is probably a better and
more consistent interface for users to understand than
widgets that appear and disappear. :-)
Happy Holidays,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|