[ By Archive-name | By Author | By Category | By Newsgroup ]
[ Home | Latest Updates | Archive Stats | Search | Usenet References | Help ]

    Search the FAQ Archives

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

Top Document: Motif FAQ (Part 6 of 9)
Previous Document: 220) How do I stop my dialog disappearing when I press the help
Next Document: 222) Why do dialog title bars have "_popup" or "<-popup"


221) 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://ftp.x.org/contrib/widget/.

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



Top Document: Motif FAQ (Part 6 of 9)
Previous Document: 220) How do I stop my dialog disappearing when I press the help
Next Document: 222) Why do dialog title bars have "_popup" or "<-popup"

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page


[ By Archive-name | By Author | By Category | By Newsgroup ]
[ Home | Latest Updates | Archive Stats | Search | Usenet References | Help ]


Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)

Last Update July 06 2008 @ 00:13 AM

© 2008 FAQS.ORG. All rights reserved.