Common Desktop Environment: Help System Author's and Programmer's Guide

To Provide a Hyperlink Callback

  1. Add a hyperlink callback to each help dialog as shown:

    XtAddCallback (helpDialog, DtNhyperlLinkCallback,
                    HyperlinkCB, (XtPointer)NULL);

    Where helpDialog is the widget ID of the help dialog and HyperlinkCB is the name of the callback function for handling hyperlinks.

  2. Write the HyperlinkCB function to handle the hyperlink events that can occur within the dialog.

    Within the hyperlink callback, you have access to the following callback structure (which is declared in <Dt/Help.h>):

    typedef struct
    		int      reason;
    		XEvent  *event;
    		char    *locationId; 
    		char    *helpVolume;
    		char    *specification;
    		int      hyperType;
    		int      windowHint;
    } DtHelpDialogCallbackStruct;

    The hyperType element indicates which type of link was executed. Its possible values are: DtHELP_LINK_TOPIC, DtHELP_LINK_MAN_PAGE, DtHELP_LINK_APP_DEFINE, or DtHELP_LINK_TEXT_FILE. For a description of which structure elements are valid for different types refer to the DtHelpDialog(3) man page.

    The windowHint element indicates a window type. Its possible values are: DtHELP_CURRENT_WINDOW, DtHELP_POPUP_WINDOW, or DtHELP_NEW_WINDOW.


The following function, HyperlinkCB(), illustrates the general structure needed to handle hyperlink callbacks.

HyperlinkCB (widget, clientData, callData)
      Widget     widget;
      XtPointer  clientData;
      XtPointer  callData;
      DtHelpDialogCallbackStruct *hyperData =
         (DtHelpDialogCallbackStruct *) callData;
      switch ((int)hyperData-> hyperType)
            case DtHELP_LINK_TOPIC:
              /* Handles  "jump new view"hyperlinks. */
            case DtHELP_LINK_MAN_PAGE:
              /* Handles  "man page" hyperlinks. */
            case DtHELP_LINK_APP_DEFINE:
              /* Handles ``application-defined" hyperlinks. */
            case DtHELP_LINK_TEXT_FILE:
              /* Handles ``text file" hyperlinks. */