Reputation: 513
Is it possible to remove the close button from a BulletinBoard widget in Motif? Or, alternatively, attach a callback function to it? I know I can do this for the toplevel widget but can't seem to do it for a BulletinBoard.
For the toplevel shell I can do this to attach a callback function to the close button:
XmAddWMProtocolCallback(toplevel, XmInternAtom(display,"WM_DELETE_WINDOW",True),
(XtCallbackProc)buttonCB, (XtPointer)data);
Or I can remove it entirely with this:
XtVaSetValues(toplevel, XmNmwmFunctions, MWM_FUNC_ALL | MWM_FUNC_CLOSE, NULL);
But neither of these work for a BulletinBoard widget. The latter has no effect. The former gives an error, "Warning: Widget must be a VendorShell."
Upvotes: 1
Views: 414
Reputation: 4084
An XmBulletinBoard widget does not have a close button. You are calling XmCreateBulletinBoardDialog, which creates an XmDialogShell with an XmBulletinBoard as its child.
Your attempt to remove the dialog's close button is incorrect.
You should use
MWM_FUNC_ALL | MWM_FUNC_RESIZE | MWM_FUNC_MOVE | MWM_FUNC_MINIMIZE | MWM_FUNC_MAXIMIZE
But it is much better to tie the close button to your own method as you tries, except you are adding the protocol callback to the wrong widget - you need it on the DialogShell, not the BulletinBoard. So use XtParent(myBB).
As an aside, you should not cast buttonCB in your call; if the compiler is complaining without the cast, your buttonCB function does not have the correct signature.
Upvotes: 0
Reputation: 513
I found a way to do this already. Instead of using XtVaSetValues, I found I can use XtSetArg(myBB, ...) at the time the BB widget is created. In other words,
n=0;
XtSetArg(args[n], XmNheight, 300); n++;
XtSetArg(args[n], XmNwidth, 300); n++;
// ...etc...
XtSetArg(args[n], XmNmwmFunctions, MWM_FUNC_ALL|MWM_FUNC_CLOSE); n++; // <--- answer
myBB = XmCreateBulletinBoardDialog(parent, "myBB", args, n);
Upvotes: 1