DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Adding online help

Creating short help

To create short help for a given object, specify the text to be associated with object and the target label widget that the short help string should be displayed in. The short help label target must be a label object that has already been created. The example shown here is a fragment from the script included at the end of this section.

proc createObjects {parent shortLabel} {

set butLabels { "Button1" "Button2" "Button3" } foreach but $butLabels { VtPushButton $parent.$but \ -shortHelpString "Short Help for $but" \ -shortHelpTarget $shortLabel }

VtPushButton $parent.exit -label Exit -callback QuitCB \ -shortHelpString "Exits this script" \ -shortHelpTarget $shortLabel }

In this procedure, the three buttons are created, each having their own short help string specified with the the -shortHelpString option. This is the string that will be displayed when the user puts focus onto that widget.

The procedure also specifies the -shortHelpTarget for each button as the shortLabel widget that was passed into the procedure. The short help target is the label widget where the short help string will be displayed. The shortLabel widget must already created before the procedure is called.

Once both of these options for each of the buttons has been specified, SCO Visual Tcl will automatically display the short help text in the specified short help target each time the user puts focus on one of these widgets.


NOTE: When the user does not have the focus on a widget that has a short help string specified, the short help target is automatically blanked out. If you wish to display a particular string instead of it being blanked-out, you can specify a short help string (with -shortHelpString) for the short help target when it is created.

The entire script is shown here:

#
# Script to show how short help works.
#

proc QuitCB {cbs} { VtClose exit 0 }

proc createObjects {parent shortLabel} {

set butLabels { "Button1" "Button2" "Button3" } foreach but $butLabels { VtPushButton $parent.$but \ -shortHelpString "Short Help for $but" \ -shortHelpTarget $shortLabel }

VtPushButton $parent.exit -label Exit -callback QuitCB \ -shortHelpString "Exits this script" \ -shortHelpTarget $shortLabel }

set ap [VtOpen ObjectTest]

set dlog [VtFormDialog $ap.dlog ]

set rc [VtRowColumn $dlog.rc -topSide FORM -leftSide FORM -rightSide FORM]

set sep [VtSeparator $dlog.sep -below $rc -leftSide FORM -rightSide FORM]

set shortLabel [VtLabel $dlog.shortLab -label "Default Short Help Info"\ -topSide NONE -bottomSide FORM -leftSide FORM -rightSide FORM\ -recomputeSize 0 -bottomOffset 2]

VtSetValues $rc -bottomSide $sep VtSetValues $sep -bottomSide $shortLabel -topSide NONE

createObjects $rc $shortLabel

VtShow $dlog

VtMainLoop


Next topic: About context-sensitive help
Previous topic: About short help

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003