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

To Display a String of Text

  1. Create a quick help dialog.

    You can use a general help dialog to display string data, but this isn't recommended because most of its features do not apply to string data.

  2. Set the following resources for the help dialog:


    Set to DtHELP_TYPE_DYNAMIC_STRING (if you want word wrap enabled) or DtHELP_TYPE_STRING (if you want the line breaks within the string to be maintained) .


    Set to the string you want to display. A copy of the string is kept internally, so you need not maintain your copy of it.

    You can also set other values for the dialog, such as its size and title.

  3. Manage the dialog using XtManageChild().


This program segment displays a string stored in the variable descriptionString.

ac = 0;
 XtSetArg (al[ac], DtNhelpType,   DtHELP_TYPE_DYNAMIC_STRING); ac++;
 XtSetArg (al[ac], DtNstringData, (char *)descriptionString);   ac++;
 XtSetValues (quickHelpDialog, al, ac);
 XtManageChild (quickHelpDialog);

If the string is no longer needed within the application, the memory can be freed, because the help dialog makes its own copy of the data.

 XtFree (descriptionString);