CK Core Motif
CK Core Motif

FormSection

XmFormSection is a presentation-only manager with an owned header, an application-owned content host, and an optional footer. Create application children only under XmFormSectionGetContent; the section owns its internal header/content/footer children and performs normal Xt geometry negotiation.

XmNformSectionHeader and XmNformSectionFooter are copied XmString values. Margin and spacing resources are explicit and scale through normal Motif dimension conversion. A missing or semantically empty (XmStringEmpty) footer remains unmapped, and narrow widths clamp child geometry without changing content ownership or managed states. The section has no form-data model, validation behavior, focus trap, or implicit overlay.

The section supplies the header and footer typography. Its content host uses a vertical layout without sharing label margins across controls: adding a toggle does not indent neighbouring field labels. The section owns the outer padding; the content host adds no second padding layer. In modern profiles, outer padding and header/content/footer spacing follow display scale and density. Explicit section margin and spacing resources remain application choices.

Accessibility exposes the section as a panel named from its header. The installed fixture covers header/footer ownership, content-child lifetime, narrow geometry, accessibility, and destruction.

Component demo

Captured gallery example and its corresponding source excerpt.

xmFormSectionWidgetClass demo

Actual gallery excerpt: class = xmFormSectionWidgetClass. The host supplies parent, name, callback and client_data. Shared factory locals: Widget example; XmString label = NULL. The shared factory frees label, attaches callbacks and sizes the preview. Helpers and the complete factory are in gallery_examples.c.

Widget panels;
example = class == xmFormSectionWidgetClass ?
    XtVaCreateManagedWidget((char *)name, class, parent, NULL) :
    XtVaCreateManagedWidget((char *)name, class, parent,
        XmNwidth, 520, XmNheight, 260, NULL);
panels = class == xmFormSectionWidgetClass ? XmFormSectionGetContent(example) :
    XtVaCreateManagedWidget("settings", xmRowColumnWidgetClass, example,
    XmNorientation, XmVERTICAL, XmNpacking, XmPACK_TIGHT,
    XmNisAligned, False, XmNspacing, 12, XmNmarginWidth, 16,
    XmNmarginHeight, 16, NULL);
{
    XmString value = XmStringCreateLocalized((char *)"Document settings");
    if (class == xmFormSectionWidgetClass)
        XtVaSetValues(example, XmNformSectionHeader, value, NULL);
    else
        XtVaCreateManagedWidget("sectionTitle", xmLabelWidgetClass, panels,
            XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Document name");
    XtVaCreateManagedWidget("nameLabel", xmLabelWidgetClass, panels,
        XmNlabelString, value, XmNalignment, XmALIGNMENT_BEGINNING, NULL);
    XmStringFree(value);
    XtVaCreateManagedWidget("documentName", xmTextFieldWidgetClass, panels,
        XmNvalue, "Quarterly report", XmNcolumns, 30, NULL);
    value = XmStringCreateLocalized((char *)"Save a backup copy");
    XtVaCreateManagedWidget("backup", xmToggleButtonWidgetClass, panels,
        XmNlabelString, value, XmNset, True, NULL);
    XmStringFree(value);
    value = XmStringCreateLocalized((char *)"Apply settings");
    Widget apply = XtVaCreateManagedWidget("apply", xmPushButtonWidgetClass, panels,
        XmNlabelString, value, NULL);
    if (callback) XtAddCallback(apply, XmNactivateCallback, callback, client_data);
    XmStringFree(value);
}
if (class == xmPanedWindowWidgetClass || class == xmPanedWidgetClass) {
    XmString preview = XmStringCreateLocalized((char *)"Preview\nQuarterly report — draft document");
    XtVaCreateManagedWidget("previewPane", xmLabelWidgetClass, example,
        XmNlabelString, preview, XmNalignment, XmALIGNMENT_BEGINNING,
        XmNmarginWidth, 16, XmNmarginHeight, 16, XmNheight, 90, NULL);
    XmStringFree(preview);
    XtVaSetValues(example, XmNheight, 360, NULL);
}

Complete demo source · Public header