[comp.windows.x] destroyCallbacks

dolanmic@nic.cerf.net (Michael A. Dolan) (06/28/91)

I am currently writing a simple application using Xt Intrinsics and Motif,
and I have a few questions that hopefully can be answered:

1)      My application is driven by a main menu, and the result of a selection
is usually a dialog created with XmCreateBulletinBoardWidget(). In order to
make the Widget modal, I am adding the widget to the grab list by calling
XtAddGrab(). When a button has been pushed from the BulletinBoard widget
indicating the user is done, in the callback I do a XtRemoveGrab(). Is this
an acceptable way to do this sort of thing, or is there a better way?

2)      Some widgets, although I add them to the grab list, will cause Xt
to report an error if I try and remove the grab. A warning dialog widget is
an example. Is there a way to check to see if a widget is on any grab list,
and the number of occurances it is on the grab list? If I can check before
I attempt to call XtRemoveGrab(), maybe I can avoid the errors.

3)      I tried an experiment with a WarningDialog widget. I added a callback
( XtNdestroyCallback ) to the widget after creation using XtAddCallback().
When, from within the application, I did an XtUnrealizeWidget() followed by
an XtDestroyWidget(), the callback was executed. However, if I close the
window by using the Motif pulldown menu associated with the window, the
callback is not invoked. Why is this? The end result is that if a user decides
to kill the window from an outside agency, I can't remove him from the grab
list and the application is hung.

        For this problem, I have considered changing the menu by using .mwmrc
so it doesn't have the close option, or taking off the menu altogether. But
I haven't had much luck here, and I am don't have the time ( sigh ) to learn
all of the intricasies of mwm ( I am embarrased not to know yet but I have a
tight schedule ). *Also*, I expect the user to also run this app from twm so
I don't want to rely on the window manager too much to help me here, I would
rather control all of this from within the application.

*I am looking for a quick but elegant fix to the above*

Given all of the choices that there seem to be in handling this, I am a bit
confused as to what is the correct way to go, and would appreciate any
immediate response you may have ( epecially since I am supposed to ship next
week!! )

Please, respond directly by e-mail to:

Syd Logan
Software Engineer, AGE Logic ( we do X servers! )
e-mail: age!syd@ucsd.edu

*Thanks*