[comp.windows.x] re-creating new widget layout of a realized toplevel shell

jhs@rocksanne.UUCP (Hans Schlichter) (04/27/89)

My problem is the following:

I have a top-level widget which contains one form widget outer;
outer itself consists of several command
buttons and several form widgets (containing a variety if other
widgets). After pressing a certain command button I want to
change my layout completely (also my widget hierarchy might be different).

I tried the following sequence to re-create a new layout (I do not supply
any sizes; the sizes should be generated from the length of my strings 
or labels):
	XtUnrealizeWidget(toplevel);
	XtDestroyWidget(outer);
	
	Sequence of XtCreateManagedWidget for each child of outer and
	their children;
	
	XtRealizeWidget(toplevel);
	XtMapWidget(toplevel);

The program invokes this code sequence after being called from the X event
loop.
However, this approach fails returning the Toolkit Error:
	Shell widget name has zero width and/or height
or if I want to unmap the toplevel widget completely I get a 
protocol error for X_DestroyWindow.

If the same sequence of code is triggered after receiving a time alarm 
(using the system call alarm(timeperiod)), 
everything works fine and the new layout for the
toplevel widget is re-created (or completely unmapped if necessary). 
In this case the program receives an
interrupt when it is still in the main event loop waiting for an 
X event. 

Is there something in the X event loop handling which keeps some state
about windows and widgets which makes it impossible to re-create the 
new layout with the approach I had in mind?

Thanks

/Hans

Arpa-Net: schlichter.wbst@xerox.com
UUCP: rochester!rocksanne!jhs