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/
|
|
|