[comp.windows.x] More developments on mixing widgets with non-widgets

dheller@cory.Berkeley.EDU (Dan Heller) (06/03/88)

I've had some interesting responses from folks ranging from "you can't
do it" to "you can, but it's not worth it."  I haven't given up my fight
yet -- quick review: I have my own application which does not use widgets
but it wants to call a routine which opens a dialog box which does use
widgets.

The problem: handling events and multiple creation and destruction of
widget trees.

Well, the handling of events has finally gotten under control.
In my main loop of the program, I test to see if the dialog box
exists and if so, I test to see if there are events in the widget
window (dialog box) by using XtPending().  If so, I service the
widget event and return.  I then test all my windows using XPending
and service my own events...

    for (;;) {
	if (DialogWinCreated && XtPending()) {
	    XtNextEvent(&event);
	    XtDispatchEvent(&event);
	}
	if (!XPending())
	    continue;
	/* deal with my own events */
    }

What I did today was create a window and open a separate dialog box
which was entirely built using the example program "xboxes" in the
Xaw examples directory.  I merely removed the call to XtMainLoop()
and just returned.  I also removed the "exit(0)" call when the "quit"
button was selected.

This works fine until I want to destroy the dialog box.  I call
XtDestroyWidget(), but it isn't unmapped as it seems it should be.
I also cannot seem to create it again.  Once XtInitialize is called,
you can't call it again.  I don't want to leave the stuff around (I
want to free the resources), so manually unmapping it just to not
have it displayed is not an acceptable solution.

Dan Heller	<island!argv@sun.com>