Parent document is top of "Motif FAQ (Part 6 of 9)"
Previous document is "222) How do I stop my dialog disappearing when I press the help"
Next document is "224) Why do dialog title bars have "_popup" or "<-popup""
223) How do I make my own dialog? I want a dialog with my own set
of buttons that stretch and shrink like the ones in e.g. PromptDialog and its
own contents.
Answer: Start off with say a PromptDialog. Unmanage the buttons you don't
want or manage the Apply button if you want another. Unmanage the other bits
of the selection box you don't want. You can add another WorkArea child to the
selection box for any extra stuff you want.
/* Copyright 1990, Kee Hinckley and Brian Holt Hawthorne */
/* Permission granted for any use, provided this copyright */
/* notice is maintained. */
/* Create a dialog box */
argcount = setArgs(&args, XmNautoUnmanage, False, NULL);
SomeDialog = XmCreatePromptDialog(mainShell, "someDialog", args, argcount);
/* Now get rid of the things we don't want */
child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_SELECTION_LABEL);
XtUnmanageChild(child);
child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_TEXT);
XtUnmanageChild(child);
/* set the callbacks, and make sure the buttons we want are there */
child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_OK_BUTTON);
XtAddCallback(child, XmNactivateCallback, callSomeFunc, someArg);
XtAddCallback(child, XmNactivateCallback, unManage, SomeDialog);
XtManageChild(child);
child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_APPLY_BUTTON);
XtAddCallback(child, XmNactivateCallback, callSomeFunc, someOtherArg);
XtManageChild(child);
child = XmSelectionBoxGetChild(SomeDialog, XmDIALOG_CANCEL_BUTTON);
XtAddCallback(child, XmNactivateCallback, dialogUnmanage, SomeDialog);
XtManageChild(child);
/* Add a new work area. This can be any manager. */
child = XmCreateForm(SomeDialog, "someForm", NULL, 0);
XtManageChild(child);
/* and fill it up... */
something = doYourStuff(child);
another Answer:
I had a some people asking about my xmSmartMessageBoxWidget
It's public domain, and needs Motif-1.2 and is available at
ftp.x.org:/contrib/widget/SmartMB.tar.Z.
The basic idea behind it is that it allows the programmer to
specify the management of child widgets in 4 areas: Label, Control,
Separator and Action. You can have up to 1 Label, 1 Control,
1 Separator and as many Action children as you want. It does not
REQUIRE any of these, and there is no unmanaging of extra widgets,
as the programmer creates what is needed.
Thanks for the smart dialog info to: John L. Cwikla
Wolfram Research, Inc. cwikla@wri.com
Parent document is top of "Motif FAQ (Part 6 of 9)"
Previous document is "222) How do I stop my dialog disappearing when I press the help"
Next document is "224) Why do dialog title bars have "_popup" or "<-popup""