[comp.windows.x.motif] Dialog Box Actions

wtm%gr.utah.edu@cs.utah.edu (Thomas McCollough) (12/14/90)

I want to make a dialog box that has a row of push buttons along the
bottom ("OK", "Reset", etc.).  I want the row of pushbuttons to stretch
and shrink just like they do in InformationDialog, QuestionDialog,
etc.  I've been using PushButtons in a RowColumn widget, but I haven't
been able to make it look as slick as what I see in InformationDialog,
QuestionDialog, etc.  How should I do this?

Thanks,
Tom McCollough
U of Utah CS Dept.

rowan@ima.isc.com (Rowan Hawthorne) (12/14/90)

In article <1990Dec13.130121.23325@hellgate.utah.edu>, wtm%gr.utah.edu@cs.utah.edu (Thomas McCollough) writes:
|> I want to make a dialog box that has a row of push buttons along the
|> bottom ("OK", "Reset", etc.).  I want the row of pushbuttons to stretch
|> and shrink just like they do in InformationDialog, QuestionDialog,
|> etc.  I've been using PushButtons in a RowColumn widget, but I haven't
|> been able to make it look as slick as what I see in InformationDialog,
|> QuestionDialog, etc.  How should I do this?
|> 
|> Thanks,
|> Tom McCollough
|> U of Utah CS Dept.

This ought to be in the FAQ list, if it isn't already. Here's what you
do.  The two tricks are that you unmanage the stuff in a prompt dialog,
and that you can add one more child to a Prompt dialog and it will put
it in the correct place. Enjoy. 

    /* 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);

		Rowan

Email	rowan@ima.isc.com	
Phone	617-661-7474 x206	
Fax	617-661-2070
upstream from the last bend in the Charles River

grywalski@idicl1.idi.battelle.org (12/14/90)

In article <1990Dec13.204634.1731@dirtydog.ima.isc.com>, rowan@ima.isc.com (Rowan Hawthorne) writes:
> In article <1990Dec13.130121.23325@hellgate.utah.edu>, wtm%gr.utah.edu@cs.utah.edu (Thomas McCollough) writes:
> |> I want to make a dialog box that has a row of push buttons along the
> |> bottom ("OK", "Reset", etc.).  I want the row of pushbuttons to stretch
> |> and shrink just like they do in InformationDialog, QuestionDialog,
> |> etc.  I've been using PushButtons in a RowColumn widget, but I haven't
> |> been able to make it look as slick as what I see in InformationDialog,
> |> QuestionDialog, etc.  How should I do this?
> |> 
> This ought to be in the FAQ list, if it isn't already. Here's what you
> do.  The two tricks are that you unmanage the stuff in a prompt dialog,
> and that you can add one more child to a Prompt dialog and it will put
> it in the correct place. Enjoy. 
> 
	Why does it take a trick to do this?  I have been trying to build
my own dialog boxes with UIL that have the same behavior as the Motif
standards, and have had little luck.  (The pushbuttons don't stretch correctly
and the nondefault buttons have the same height as the default button.)
I assumed I just hadn't stumbled on the the correct combination of parameters. 
I will be very disappointed if I can't generate a "standard Motif like" dialog
box with UIL.  Has anyone had any success with this?  If so could you post
an example?

-- 
* Roger Grywalski - Software Developer      GRYWALSKI@IDICL1.IDI.BATTELLE.ORG
* Information Dimensions Inc.
* 655 Metro Place South
* Dublin, Ohio 43017

rowan@ima.isc.com (Rowan Hawthorne) (12/15/90)

In article <19.2768a262@idicl1.idi.battelle.org>, grywalski@idicl1.idi.battelle.org writes:
|> 	Why does it take a trick to do this?  I have been trying to build
|> my own dialog boxes with UIL that have the same behavior as the Motif
|> standards, and have had little luck.  (The pushbuttons don't stretch correctly
|> and the nondefault buttons have the same height as the default button.)
|> I assumed I just hadn't stumbled on the the correct combination of parameters. 
|> I will be very disappointed if I can't generate a "standard Motif like" dialog
|> box with UIL.  Has anyone had any success with this?  If so could you post
|> an example?

The standard dialog boxes do explicit size calculations on the buttons,
and set the sizes and positions this way. I'm afraid you will be very
disappointed if you continue to do it any other way.

You could certainly do it in UIL, but you will have to calculate the
sizes yourself, and hard-code them. 

		Rowan

Email	rowan@ima.isc.com	
Phone	617-661-7474 x206	
Fax	617-661-2070
upstream from the last bend in the Charles River

nazgul@alphalpha.com (Kee Hinckley) (12/17/90)

> 	Why does it take a trick to do this?  I have been trying to build
> my own dialog boxes with UIL that have the same behavior as the Motif
> standards, and have had little luck.  (The pushbuttons don't stretch correctly
> and the nondefault buttons have the same height as the default button.)
> I assumed I just hadn't stumbled on the the correct combination of parameters. 
> I will be very disappointed if I can't generate a "standard Motif like" dialog
> box with UIL.  Has anyone had any success with this?  If so could you post
> an example?

Actually you probably can do it in UIL - I think the PD Table widget
could handle the layout.  But that probably wasn't the answer you
were looking for.  Besides which, you still have the problem of getting
the translations for Return to work properly so that the correct button
gets activated.  I do all of my custom dialogs by creating a PromptDialog,
unmanaging the stuff I don't want, and creating a Form or Table inside
of it.  UIL may be okay for laying out some widgets where you want
them, but I've yet to see any Motif-based interface language or IDT
that I could use to solve all of my interface needs.  (Well, I suspect
that the one with a builtin C interpreter could, but that's cheating, and
besides which, I'm using C++ :-).
					-kee