CK Core Motif
CK Core Motif

Teaching tip

XmTeachingTip is an opt-in, non-modal anchored presentation layered over the same Xt shell rules as XmFlyout. Create it as an unmanaged child of its owner with XmCreateTeachingTip, provide copied XmNteachingTipTitle and XmNteachingTipText values, and call XmTeachingTipShow or XmTeachingTipHide explicitly.

XmNteachingTipDelay delays the show in milliseconds. A pending delay is cancelled by hide, a second show, owner unmap or owner destruction. Showing creates a transient override-redirect shell below the owner, clamps it to the active screen and uses XtGrabNone; it never moves focus or changes menu and dialog admission. Escape/Return, pointer activation, explicit hide and owner unmap dismiss the tip and invoke XmNteachingTipDismissCallback (owner destruction does not call application callbacks after the owner is gone).

Title and body strings are copied by the widget. The widget owns its popup labels and timer; applications own the owner and decide when a tip is useful. The accessibility bridge exposes a panel named from the title, then body, or the deterministic Teaching tip fallback. There is no global tooltip queue, pointer tracker or external URL/action dispatch.

tests/automated/run-teaching-tip.py validates delay cancellation, show/hide, screen-edge placement, accessibility and owner teardown under Xvfb.

Component demo

Captured gallery example and its corresponding source excerpt.

xmTeachingTipWidgetClass demo

Actual gallery excerpt: class = xmTeachingTipWidgetClass. 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.

XmString caption = XmStringCreateLocalized((char *)(class == xmFlyoutWidgetClass ? "Show details" : "Show keyboard tip"));
/* Popup handles stay unmanaged. Only the trigger participates in this
 * compact owner layout, so popup placement follows the button bounds. */
Widget owner = XtVaCreateManagedWidget("popupAnchor", xmRowColumnWidgetClass, parent,
    XmNorientation, XmVERTICAL, XmNmarginWidth, 0, XmNmarginHeight, 0,
    XmNspacing, 0, NULL);
Widget trigger = XtVaCreateManagedWidget("showPopup", xmPushButtonWidgetClass, owner,
    XmNlabelString, caption, NULL);
XmStringFree(caption);
example = XtVaCreateWidget((char *)name, class, owner, NULL);
if (class == xmFlyoutWidgetClass)
    XtVaSetValues(example, XmNflyoutText, "Document details\nSaved locally and ready to export.", NULL);
if (class == xmTeachingTipWidgetClass) {
    XmString title = XmStringCreateLocalized((char *)"Move with the keyboard");
    XmString body = XmStringCreateLocalized((char *)"Press Tab to move forward and Shift+Tab to move back.");
    XtVaSetValues(example, XmNteachingTipTitle, title, XmNteachingTipText, body,
        XmNteachingTipDelay, 0, NULL);
    XmStringFree(title); XmStringFree(body);
}
XtAddCallback(trigger, XmNactivateCallback, show_popup_example, example);

Complete demo source · Public header