System Close Button

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
System Close Button

Submitted by mmccarty12 on Fri, 02/13/2009 - 18:05.

On the top right of most windows today there is normally a little button with an X in it. It, of course, means close this window when the use clicks on it. I know how to capture this event when using wxWidgets, but have no idea how to capture the event when using Motif. I am currently maintaining a piece of legacy software developed completely in Motif, and have a problem.

Many places in this software there are popup dialogs created. Whenever the user closes the window using the "done" or "cancel" or "ok" buttons, the main window reacts fine. But, when the user closes the window with the system button, the main parent does not release itself to normal behavior. This is because there is no callback set to capture the close event from the system menu. I already have figured out how to create the callback using the XtAddCallback(dialog_w, XmNokCallback, CBBCmenu_active, NULL) function, but I cannot find any parameters for the second parameter that indicate this is going to link the callback when the system close option is taken.

I am required to keep the system menu items available, so removing the close option and the close button is not an option.

Can anyone help or suggest a direction so I can fix this problem.

Thanks

Tue, 03/03/2009 - 13:53#1

Tue, 03/03/2009 - 13:53#1

dpeterc

Re: System Close Button

You can try this:
XmpAddMwmCloseCallback(appShell, myCloseCB, NULL);

and then you need this function somewhere in your program
void myCloseCB(Widget w, XtPointer clientData, XtPointer callData)
{
// do whaterver is needed
}