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

To Display a Text File

  1. Create a quick help dialog or retrieve one from your dialog cache.

    You can use a general help dialog to display a text file, but this isn't recommended because most of its features are useful only for standard help topics.

  2. Set the following resources for the help dialog:


    Set to DtHELP_TYPE_FILE..


    Set to the file name you want to display. If the file is not in the application's current directory, provide a path to the file.

    You can also set other values for the dialog, such as its size and title. In particular, you might want to set the width to 80 columns, which is the standard width for text files.

  3. Manage the dialog using XtManageChild().


The following program segment displays a file named /tmp/printer.list. It also sets the size of the dialog to better suit a text file.

ac = 0;
 XtSetArg (al[ac], DtNhelpType, DtHELP_TYPE_FILE);      ac++;
 XtSetArg (al[ac], DtNhelpFile,  "/tmp/printer.list");  ac++;
 XtSetArg (al[ac], DtNcolumns,  80);                    ac++;
 XtSetArg (al[ac], DtNrows,     20);                    ac++;
 XtSetValues (quickHelpDialog, al, ac);
 XtManageChild (quickHelpDialog);