![]() |
![]() HP OpenVMS Systems Documentation |
![]() |
DECwindows Motif Guide to Application Programming
4.10 Using the Toolkit Help Widget Creation RoutineAs described in Section 4.7, you can implement the help widget through UIL or through the Toolkit help widget creation routine. Example 4-9 demonstrates how to create a help widget using the Toolkit help widget creation routine.
Chapter 5
|
For the purpose of example, the OpenVMS DECburger sample application uses both the help system and the help widget to implement help. To present a consistent user interface, your application should implement only one help model. |
The help system uses the DECwindows Bookreader as its display window. The help system routines allow your application to invoke Bookreader and specify the book, as well as the specific topic or directory within that book, to display first. In addition, once Bookreader is invoked through the help system, it remains available until the user explicitly closes it or ends the DECwindows session.
The help system provides the following Bookreader features to users of your application:
Figure 5-1 shows a comparison of the help widget and the help system.
Figure 5-1 Comparison of Help Widget and the Help System Windows
To implement the help system, perform the following steps:
A user can invoke the help system in four ways:
As an application developer, you must decide which help invocation
methods to support. Most DECwindows applications support invoking help
by clicking on a help option in the menu bar and through
context-sensitive help.
5.3 Help File Information
You can use VAX DOCUMENT on OpenVMS for VAX systems or DECwrite to
create Bookreader files for the help system. The remainder of this
section uses a help file created using VAX DOCUMENT for the purpose of
example.
5.4 Help File Information---VAX DOCUMENT Example
Help-system help files created with VAX DOCUMENT are standard SDML files processed with the SOFTWARE.ONLINE document type for Bookreader output.
You can use any standard section tag (<HEADn>) as a help topic. The symbol name associated with the tag <HEADn\symbolic_name> must match the topic identifier specified in the UIL file.
Example 5-1 shows the DECBURGER.DECW$BOOK file as a VAX DOCUMENT DECBURGER_HELP.SDML file. Note that topics identified by INCLUDE commands in the HLP file are identified by <HOTSPOT> tags in the SDML file. Also note that for the help system you need to specify only the topic identifier in the symbolic name. (The help widget uses the key name hierarchy to find the help topic and requires the key names that form a path to the topic.)
The DECBURGER_HELP.SDML file is presented only as an example; refer to the DECwindows Companion to the OSF/Motif Style Guide for the recommended content and style of a help file. |
Example 5-1 DECBURGER_HELP.SDML Help File |
---|
(1)<FRONT_MATTER>(dwhlp_front) <TITLE_PAGE> <TITLE>(Help on DECburger) <ENDTITLE_PAGE> <CONTENTS_FILE> <ENDFRONT_MATTER> <HEAD1>(Overview of the Help Widget\overview) <P> A help widget is a modeless widget that allows you to display appropriate, context-sensitive help text in response to a user query. The help widget can be viewed as an independent application that your application calls to provide help functions. <P> The help widget creates and manages one or more help windows and determines the first topic to be displayed to the user. <P> Additional topics: <LIST>(UNNUMBERED) (2)<LE><HOTSPOT>(functions_1) <LE><HOTSPOT>(create_help_widget) <ENDLIST> <HEAD2>(Using the Help widget\functions_1) <P> To use the help widget, you perform the following steps: <LIST>(NUMBERED\1) <LE>Use the OpenVMS Librarian Utility (LIBRARIAN) to create a help library. <LE>Create a Help menu bar item for your application. The Help menu item should be located at the right of the menu bar. If the menu bar is wider than a line, the Help menu item should be located at the bottom right. <ENDLIST> <HEAD1>(About the Help Widget\about) <P> This topic provides version information. <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(create_help_widget) <ENDLIST> <HEAD1>(Help Widget On Help\onhelp) <P> This topic provides help-on-using-help information. <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(create_help_widget) <ENDLIST> <HEAD1>(Menu Bar Context Sensitive Help\menu_bar) <HEAD1>(File Menu Context Sensitive Help\file_menu) <HEAD1>(Edit Menu Context Sensitive Help\edit_menu) <HEAD1>(Not Yet Implemented\not_implemented) <HEAD1>(Order Menu Context Sensitive Help\order_menu) <HEAD1>(Order Context Sensitive Help\order) <P> Order menu context-sensitive help <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(burgers) <LE><HOTSPOT>(fries) <LE><HOTSPOT>(drink) <LE><HOTSPOT>(apply) <LE><HOTSPOT>(dismiss) <LE><HOTSPOT>(create_help_widget) <ENDLIST> <HEAD2>(Burgers For Us\burgers) <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(burgers_rare) <LE><HOTSPOT>(burgers_medium) <LE><HOTSPOT>(burgers_well) <LE><HOTSPOT>(burgers_ketchup) <LE><HOTSPOT>(burgers_mustard) <LE><HOTSPOT>(burgers_onion) <LE><HOTSPOT>(burgers_mayo) <LE><HOTSPOT>(burgers_pickle) <LE><HOTSPOT>(burgers_quantity) <ENDLIST> <HEAD3>(Burgers For Us\burgers_rare) <HEAD3>(Burgers Medium For Us\burgers_medium) <HEAD3>(Burgers Well For Us\burgers_well) <HEAD3>(Burgers Ketchup For Us\burgers_ketchup) <HEAD3>(Burgers Mustard For Us\burgers_mustard) <HEAD3>(Burgers Onion For Us\burgers_onion) <HEAD3>(Burgers Mayo For Us\burgers_mayo) <HEAD3>(Burgers Pickle For Us\burgers_pickle) <HEAD3>(Burgers Quantity\burgers_quantity) <HEAD2>(Fries For Us\fries) <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(fries_tiny) <LE><HOTSPOT>(fries_small) <LE><HOTSPOT>(fries_medium) <LE><HOTSPOT>(fries_large) <LE><HOTSPOT>(fries_huge) <LE><HOTSPOT>(fries_quantity) <ENDLIST> <HEAD3>(Tiny Fries\fries_tiny) <HEAD3>(Small Fries\fries_small) <HEAD3>(Medium Fries\fries_medium) <HEAD3>(Large Fries\fries_large) <HEAD3>(Huge Fries\fries_huge) <HEAD3>(Fries Quantity\fries_quantity) <HEAD2>(Drink Choices\drink) <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(drink_list) <LE><HOTSPOT>(drink_quantity) <LE><HOTSPOT>(drink_add) <LE><HOTSPOT>(drink_sub) <ENDLIST> <HEAD3>(Drink List\drink_list) <HEAD3>(Drink Quantity\drink_quantity) <HEAD3>(Drink Add\drink_add) <HEAD3>(Drink Subtract\drink_sub) <HEAD2>(Help on Apply\apply) <P> This topic provides information on both Apply and Reset. <HEAD2>(Help on Dismiss\dismiss) <HEAD1>(Help on Custom Colors\customize) <HEAD1>(Help on Print Order\print) <HEAD1>(Programming Help\programming) <P> Programming help. <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(creating) <ENDLIST> <HEAD2>(Creating a Help widget\creating) <P> Creating a help widget. <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(create_help_widget) <ENDLIST> <HEAD3>(Creating a Help widget\create_help_widget) <P> Programming help for creating a help widget. <HEAD1>(Help Widget Glossary\glossary) <P> This topic provides glossary information. <P> Additional topics: <LIST>(UNNUMBERED) <LE><HOTSPOT>(create_help_widget) <ENDLIST> |
When you invoke the help system, you pass a help file specification to the DXmHelpSystemOpen routine. The default location is SYS$HELP and the default file extension is DECW$BOOK, but you can provide your own location or extension along with the help file name. The help system uses this specification to locate and read the help file.
For example, you can define a symbolic name for the help file specification:
#define decburger_help "decw$examples:decburger_help.decw$book" |
Then pass this symbolic name as the help file specification:
DXmHelpSystemOpen(&help_context, toplevel_widget, decburger_help, help_error, "Help System Error"); |
In context-sensitive help, the application presents direct help on the current topic rather than starting at a higher level and working down through a help hierarchy. Users do not have to navigate through several layers of help to find the information they need.
All widgets that are a subclass of the XmPrimitive or XmManager widget class support a help callback with a reason of XmCR_HELP. (Other widgets can also support the help callback, but there is no requirement to do so.) Your application uses this help callback to implement context-sensitive help by associating a help callback routine with the widgets for which you want to provide help.
The Toolkit includes a routine, DXmHelpOnContext, that applications can use to enter context-sensitive help mode.
The OSF/Motif Style Guide recommends that, within dialog boxes, context-sensitive help should be provided for the dialog box as a whole. The first help frame should be an overview of the dialog box, with additional topics about each object in the dialog box. To be consistent with the recommendations of the OSF/Motif Style Guide, you need to provide a help callback only for the dialog box itself, not for the objects within the dialog box. Because the DXmHelpOnContext routine checks a widget's nearest ancestors until it finds a widget with an associated help callback routine, a user should be able to get context-sensitive help on a dialog box by clicking anywhere within that dialog box. |
Example 5-4 shows a sample help callback routine.
The remainder of this section describes how to implement
context-sensitive help.
5.5.1 Creating the On Context Push Button in UIL
Example 5-2 shows how to create an On Context push button in the Help pull-down menu.
Example 5-2 The On Context Push Button in UIL |
---|
. . . object help_menu_entry : XmCascadeButton { arguments { XmNlabelString = k_help_label_text; XmNmnemonic = keysym("H"); }; controls { XmPulldownMenu help_menu; }; callbacks { XmNhelpCallback = procedure help_system_proc(k_help_help); }; }; object help_menu : XmPulldownMenu { controls { XmPushButton help_sensitive; XmPushButton help_window; XmPushButton help_version; XmPushButton help_onhelp; }; callbacks { XmNhelpCallback = procedure help_system_proc(k_help_help); }; }; object help_sensitive : XmPushButton { arguments { XmNlabelString = k_sensitive_label_text; XmNmnemonic = keysym("C"); }; callbacks { (1)XmNactivateCallback = procedure activate_proc (k_help_sensitive); XmNhelpCallback = procedure help_system_proc(k_sensitive_help); }; }; . . . |
Previous | Next | Contents | Index |