Hypertext Help |
17 |
![]() |
Obviously you are free to re-implement the callback that you use in your application to make it interface with the help system of your choice. Likewise, you can achieve the same effect simply by using the ordinary callback mechanisms, or you can decide not to give your users any on-line help at all.
You set up help for your application in the same way, regardless of which viewer you intend to use. You then link your application with the appropriate supplied library, as described in the Help Implementation section on page 584.
17.3.1 WorkShop Visual Help
WorkShop Visual Help is the help viewer used by WorkShop Visual and is shown in Figure 17-1.
Figure 17-1 WorkShop Visual Help Viewer
See Appendix D, "Further Reading for suggested books on HTML.
17.3.2 Netscape
Netscape is a browser which takes HTML (HyperText Markup Language) files and displays them complete with any hypertext links or special formatting you have specified. 17.3.3 FrameMaker
FrameMaker is a desktop publishing package which uses its own internal format. FrameMaker also provides a means of viewing and browsing around read-only documents. For information on using FrameMaker as your help viewer, see the Using FrameMaker section on page 577.
17.3.4 Using HTML in Help Documents
Both WorkShop Visual Help and Netscape read HTML files. You will need to write the files so that you have specified HTML anchors at points which will be the source and destination of a link. You should remember the names of these anchors as they are used to specify the help action for individual widgets.
In HTML tags are enclosed within angle brackets (< and >). You must use these brackets in your text files. See the Example HTML document section on page 576 for an illustration of the way you should use HTML tags in your documents.
The tags have been divided into categories according to their usage. Note that the tags are listed here in uppercase. HTML, however, is not a case sensitive language. You can, therefore, use either case.
Starting and Ending
<HTML> All HTML documents start with this tag. Anchors and Links
<A NAME="anchorname">text</A> This is an anchor which will be used as the destination of a link. anchorname is your internal name for the anchor. text is the text you want people to click on to go to the link destination. Paragraph
<P> This tag is used to indicate the start of a paragraph. Paragraphs are separated by a blank line. Break
<BR> This tag indicates a hard line break. If there is no line break, the text will flow to fit the width of the browser window. Lists
WorkShop Visual Help does not handle the different types of list in the way most HTML interpreters do. Lists are interpreted for compatibility so that existing HTML documents can be used. Character Formats
<EM> Indicates the following text should be emphasized. Some HTML interpreters use italic and some use bold. WorkShop Visual Help prints a `*' (asterisk) before and after the text. Headings
HTML defines a range of headings from "H1" to "H6" which, according to most HTML interpreters, start large and bold and gradually lessen in size and weight. WorkShop Visual Help simply prints two blank lines before a heading. The heading tags indicate the beginning and end of the text of the heading: Preformatted Text
<PRE> Most HTML interpreters format the text in a HTML document ignoring any extra spaces, tabs or line returns. The "preformatted" tag causes the interpreter to print the text as you typed it and uses a monospaced font, such as Courier. WorkShop Visual Help only prevents the output function from stripping white space. 17.3.6 Example HTML document
Below is an example of a help document written for WorkShop Visual Help in HTML:<html>
About WorkShop Visual
<h1>About WorkShop Visual </h1>
<p>This is WorkShop Visual, a tool to help you develop Motif
Graphical user Interfaces. </p>
<p>
If you are new to WorkShop Visual, select `Getting Started' in the
list below, and then press the Follow link button.
</p>
<p>
A complete list of help topics is available, and can be viewed
by similarly selecting the `Index of Help Topics' item.
</p>
See also:
<ul>
<li><a href="get_started">Getting Started</a><br>
<li><a href="dialogs">Resource Panels and other >WorkShop
Visual
dialogs</a><br>
<li><a href="widget_list">Widgets</a><br>
<li><a href="code_gen">Code Generation</a><br>
<li><a href="index">Index of Help Topics</a><br>
</ul>
</html>
This file is shown displayed in WorkShop Visual Help in Figure 17-1.
17.3.7 Using FrameMaker
If you plan to use FrameMaker to build your help system, you must know how the FrameMaker hypertext system works. Complete documentation is provided in your FrameMaker manuals and a brief summary is given below.
To specify a tag, type the name of the document and the name of the marker, and press "Apply". You should now be able to display that document by invoking the callback in the dynamic display, which is done by clicking on the button for an Activate callback, or pressing <F1> for a Help callback.
Note - The Activate callback for a CascadeButton is only called if there is no pulldown menu associated with it.
When you specify tag information in the Core resource panel, WorkShop Visual automatically adds the callback function XDhelp_link() to the appropriate callback list for the widget. You do not have to specify a callback in the Callbacks dialog for the widget.
In the case of the Activate callback, if no document is explicitly set the document for the Help callback is used. If this is not set, the same Help document inheritance, described above, takes place.
Figure 17-2 Help defaults dialog
17.6 Finding Help Documents and Markers
The "Activate callback" and "Help callback" buttons in the "Code generation" page of the Core resource panel can be used to display a dialog showing all the documents and markers that are currently referenced by your design.Figure 17-3 Help Documents and Markers Dialog
17.7 Linking Help into your Application
To use WorkShop Visual's default help callback function, you must link in the supplied object files which can be found in WorkShop Visual's installation directory (referred to below as $VISUROOT). 17.7.1 WorkShop Visual Help
To use WorkShop Visual Help you will need to link the file helplink.o in with your application. The source of this object file, helplink.c, is found in:$VISUROOT/src/libhelplink/helplink
There is also a Makefile with instructions for building helplink.o and a file named README with information on linking in WorkShop Visual Help.$VISUROOT/src/help/client
There is a Makefile in that directory with instructions for building the library. 17.7.2 Netscape
To use Netscape you will need to link the file helplink.o in with your application. The source of this object file, helplink.c, is found in:$VISUROOT/src/libhelplink/nshelplink
There is also a Makefile with instructions for building helplink.o and a file named README with information on linking in Netscape. 17.7.3 FrameMaker
To use FrameMaker you will need to link the file helplink.o in with your application. The source of this object file, helplink.c, is found in:$VISUROOT/src/libhelplink/fmhelplink
There is also a Makefile with instructions for building helplink.o and a file named README with information on linking in FrameMaker.$VISUROOT/src/libhelplink/fmhelplink/libframe/fmclient
There is a Makefile in that directory with instructions for building the library. 17.7.4 Other
You can also supply your own Help callback function. This function should also be called XDhelp_link() and should follow the same form as WorkShop Visual's function. See the Help Implementation section below for suggestions on how to customize the Help callback function.
17.8 Help Implementation
The preceding descriptions show how the help system works within WorkShop Visual. If you use the default Help callback provided with WorkShop Visual, the help in your application will work in the same way. However, you may want to customize your implementation of the Help callback. The following sections describe how to do so using the FrameMaker integration as a guide.typedef struct _XDHelpPair_s {
_XDHelpDoc_p doc;
char ** tag;
Bool open_doc;
} _XDHelpPair_t, *_XDHelpPair_p;
This contains a pointer to an _XDHelpDoc_t structure, a pointer to a marker (tag), and an open_doc flag. If tag is NULL the developer has specified one of the default markers: <Widget name> if open_doc is FALSE, <Open> if open_doc is TRUE. The document structure is:typedefstruct_XDHelpDoc_s{
char * doc;
char ** path;
int handle;
Bool new_window;
}_XDHelpDoc_t,*_XDHelpDoc_p;
The doc field is the name of the document. path is a pointer to the default path if one exists. This path is calculated as described above, taking account of the setting of the help path application resource and environment variable. handle is the document handle returned from FrameMaker, and new_window specifies whether the document is to have its own window.