davids@gdfwc3 (David Reed Smith) (05/30/91)
Fellow Motif'ers, I am trying to create several custom dialogs that act and look like the standard Motif dialogs (file selection dialog, error dialog, etc.), but am having trouble. By 'act like the standard Motif dialogs', I mean how the standard dialogs handle resize actions. By 'look like the standard Motif dialogs', I mean have the basic 3 buttons (OK, Cancel, Help), a separator gadget, and a area for the dialog's information. I I guess I should state I am using Motif 1.1. As an example, I am trying to create a dialog like this: ----------------------------------------- | | | LabelGadget TextWidget | | toggleButtonGadget1 | | toggleButtonGadget2 | | toggleButtonGadget3 | | | |---------------------------------------- | | | [Ok] [Cancel] [Help] | | | ----------------------------------------- What is the collection of widget's/gadget's that will accomplish this look? How do I get these widget's/gadget's to act like a dialog if the user resizes? Please E-mail me and I'll summarize if there is any interest. Thank you -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ David Smith davids@gdfwc3, General Dynamics, gdfwc3!davids@central.sun.com, Fort Worth Division or uunet!texsun!gdfwc3!davids ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tsang@ISI.COM (Kam C. Tsang) (05/31/91)
> I am trying to create several custom dialogs that act and look like > the standard Motif dialogs (file selection dialog, error dialog, > etc.), but am having trouble. By 'act like the standard Motif > dialogs', I mean how the standard dialogs handle resize actions. > By 'look like the standard Motif dialogs', I mean have the basic 3 > buttons (OK, Cancel, Help), a separator gadget, and a area for the > dialog's information. Create a selection box (may be with XmNdialogType XmDIALOG_PROMPT), unmanage the selection label and the text widgets of the selection box, then create a form widget using the selection box as parent. You can then create your own stuff inside this form. In code, use this piece from the FAQ: Subject: 34) 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); -kam