|
|
In this example let us take a look how the item descriptor
lininfo
and the built-in variable
LININFO can be used
in conjunction with the frame descriptor
help
to define help that is specific to the current menu item.
This example defines a menu titled TOP MENU that has three items. The first item does not have any help information. When help is requested while the cursor is on this item, the help text frame for the menu is displayed. The second and third item have help text frames associated with each item. The menu definition file for this menu is:
menu=TOP MENU help=`if [ $LININFO = "" ]; then echo open Text.gen_help; else echo open '$LININFO'; fi`name=Item 1 action=nop
name=date action=`date | message`nop lininfo=Text.item2
name=exit action=exit lininfo=Text.item3
Menu.lininfo: an example of defining help with LININFO
The text frame
definition file
Text.gen_help
displays information appropriate to the menu as a whole.
(Presumably this information is also sufficient for a user to
understand how to use the first menu item,
Item 1
.)
columns=20 lifetime=shortterm title="Help on TOP MENU" text="This menu demonstrates the lininfo descriptor. The first item does not use the lininfo descriptor."
Text.gen_help: an example of a help text frame
The text frame definition files
Text.item2
and
Text.item3
display appropriate help information for
the second and third items on the menu.
columns=20 lifetime=shortterm title="Help on date" text="The selection of this item will display the current date and time on the message line"
Text.item2: an example of a help text frame
columns=20 lifetime=shortterm title="Help on exit" text="This item will let you get out of the application"
Text.item3: an example of a help text frame
When this application is run, the user sees the following menu:
Menu.lininfo: screen output
If the user asks for help, either by the appropriate function key,
or by the
help
command (from the command line or the Command Menu),
the appropriate text frame will be displayed.
The
lifetime
descriptor, defined in each of the help text frames to be
shortterm
,
ensures that whenever the user navigates away from the help
text frame, it will be removed from the work area, thus reducing
screen clutter:
Menu.lininfo: screen output after requesting help on item 1
If the user navigates to the second menu item and again asks for help, the following text frame will be displayed:
Menu.lininfo: screen output after requesting help on item 2
The text defined in Text.item3 is displayed in the same manner when <HELP> is pressed while the cursor is positioned on menu item 3, exit. The display of these help frames is controlled by the lininfo descriptor and the LININFO variable.
The previous example of defining help text frames using the LININFO variable could be coded instead using the textframe command. This would eliminate the need for 3 text frames.
To do so, you would change the line in Menu.lininfo that is coded as
else echo open '$LININFO';to something like
else echo textframe -c20 '$LININFO';Then the corresponding values for LININFO later in that file would be coded with the text values from the text descriptors in the respective text frame definition files in the example. If the different titles for each frame were to be kept as well, then the LININFO variable for each item would have to include it:
lininfo='-t "frame title" "Text contents"'