Index of /archives/X/opengroup/contrib/widgets/motif/SmartMB

Icon  Name                                         Last modified      Size  Description
[PARENTDIR] Parent Directory - [TXT] README 1994-09-27 08:00 3.6K [TXT] CHANGES 1994-12-02 09:00 1.6K [CMP] SmartMB.1.3.1.tar.Z 1996-10-23 08:00 36K
                                SmartMessageBox Widget
-----------------------------------------------------------------------------

This is the xmSmartMessageBoxWidget.  The basic idea is that I decided
that dialogs should be simpler in Motif programs, ie, you shouldn't have
to unmanage unwanted widgets just to have a dialog.  Plus, the Template
dialog is more voodoo than anything else.  The SmartMessagBox widget
manages whatever you tell it to in 4 different ways: as a label, as
a control widget, as a separator, or as an action widget.  You can
have up to 1 label, up to 1 control, up to 1 separator, and as many action widgets
as you'd like.  This is all handled throught constraint resources.

The basic setup is:

      ------------------------------------
      - Label |                          -
      -           |       Control        -
      -----------|         Area          -
      -           |                      _
      -       separator                  - 
      ------------------------------------
      -            Action                -
      -            Area                  -
      ------------------------------------

Although you don't need to have all of the different areas.

	When you create a child of a SmartMessageBoxWidget, it's
constraint resource XmNchildType defaults to XmCHILD_ACTION, which
means for it to be managed in the action area.  You can change
this resource so that it is managed in any of the 4 fields above.
A basic dialog box would then look like:

    smb = XtCreateManagedWidget("SmartMessageBox", xmSmartMessageBoxWidgetClass,
        toplevel, NULL, 0);

	n = 0;
	XtSetArg(warg[n], XmNchildType, XmCHILD_LABEL); n++;
    XtCreateManagedWidget("Label", xmLabelWidgetClass, smb, warg, n);

	n = 0;
	XtSetArg(warg[n], XmNchildType, XmCHILD_SEPARATOR); n++;
    XtCreateManagedWidget("Separator", xmSeparatorWidgetClass, smb, warg, n);

	n = 0;
	XtSetArg(warg[n], XmNchildType, XmCHILD_CONTROL); n++;
    XtCreateManagedWidget("MessageLabel", xmLabelWidgetClass, smb, warg, n);

/*
** These default to the action area.
*/

    defButton = XtCreateManagedWidget("OK", xmPushButtonWidgetClass, smb, warg, n);
    XtCreateManagedWidget("Help", xmPushButtonWidgetClass, smb, NULL, 0);

    n = 0;
    XtSetArg(warg[n], XmNdefaultButton, defButton); n++;
    XtSetValues(smb, warg, n);

	The other resources are:

	XmNminimizeButtons: (Boolean) make all the widgets in the action
		area the smallest possible

	XmNdialogType: (XmDIALOG_INFORMATION, etc.) adds the appropriate
		bitmap to the dialog as a label automatically

	XmNdialogPositioning: positions the dialog on popups to

XmDIALOG_POSITIONING_LEAVE_ALONE: let the window manager do whatever

XmDIALOG_POSITIONING_INITIAL_CENTER: first time it pops up centered in
	the screen, afterwards it pops up wherever it was left

XmDIALOG_POSITIONING_ALWAYS_CENTER: always pops up in the center of
    the screen

XmDIALOG_POSITIONING_DEFAULT_AT_POINTER: positions the dialog up so that the
    default button is centered on the pointer

XmDIALOG_POSITIONING_CENTER_AT_POINTER: positions the dialog up so that the
    dialog is centered on the pointer



	To build the SmartMessageBoxWidget you will need Motif 1.2.  Plus
if you have a version < 1.2.3 you will need to #define NEED_BBCONSTRAINT 1
since the Motif headers didn't have the Bulletin board constraint part like
they should have.

  That's about it.  Let me know what you think, and if I get encouraged
then maybe I'll write some more...See copyright or source files for
distribution info...

  John L. Cwikla
  [email protected]

  Furthering "open software" into reality...