|
|
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} {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.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 }
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.
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