|
|
The Object menu should be the name of the primary system resource being managed (examples: User, Printer, Filesystem). The functions under this menu usually involve creating, modifying, or deleting an object.
Template menu procedure: UiBuildMenus
proc UiBuildMenus {form} {
global appvals
set menuBar [VtMenuBar $form.menuBar \
-helpMenuItemList [SaHelpGetOptionsList]]
VxSetVar $form menuBar $menuBar
set openhost $appvals(openhost)
if {$openhost} {
UiBuildHostMenu $menuBar
}
# Main object menu
UiBuildObjectMenu $menuBar
# view menu for auto refresh?
UiBuildViewMenu $menuBar
UiBuildOptionsMenu $menuBar
return $menuBar
}
#====================================================================== XXX ===
# UiBuildHostMenu
#
# Build the host menu including:
# o Open Host...
# o Exit
#------------------------------------------------------------------------------
proc UiBuildHostMenu {parent} {
global appvals
set hostMenu [VtPulldown $parent.hostMenu \
-label [IntlMsg HOST] \
-mnemonic [IntlMsg HOST_MN] \
]
VxSetVar $parent hostMenu $hostMenu
VtPushButton $hostMenu.openhost \
-label [IntlMsg OPENHOST] \
-mnemonic [IntlMsg OPENHOST_MN] \
-acceleratorString [IntlMsg OPENHOST_ACCSTR] \
-accelerator [IntlMsg OPENHOST_ACC] \
-shortHelpCallback SaShortHelpCB \
-shortHelpString [IntlMsg OPENHOST_SH \
[list $appvals(itemname)]] \
-callback SaOpenHostCB \
-autoLock SaOpenHostCB
VtSeparator $hostMenu.s1
set exitMenu $hostMenu
# exit button
VtPushButton $exitMenu.exit \
-label [IntlMsg EXIT] \
-mnemonic [IntlMsg EXIT_NM] \
-shortHelpCallback SaShortHelpCB \
-shortHelpString [IntlMsg EXIT_SH [list $appvals(title)]] \
-callback UiCloseCB \
-autoLock UiCloseCB
# Correct/consistent UI does not use Exit accelerators
#-acceleratorString "Ctrl+X"
#-accelerator "Ctrl<Key>X"
}
#====================================================================== XXX ===
# UiBuildObjectMenu
#
# Build the object(Who) menu including:
# o Examine...
#------------------------------------------------------------------------------
proc UiBuildObjectMenu {parent} {
global appvals
if {$appvals(examineMenu)} {
set label $appvals(object)
set mnemonic $appvals(objectmn)
set fileMenu [VtPulldown $parent.fileMenu \
-label $label \
-mnemonic $mnemonic \
]
VxSetVar $parent fileMenu $fileMenu
}
# examine button
if {$appvals(examineMenu)} {
set examine [VtPushButton $fileMenu.examine \
-label [IntlMsg EXAMINE] \
-mnemonic [IntlMsg EXAMINE_MN] \
-shortHelpCallback SaShortHelpCB \
-shortHelpString [IntlMsg EXAMINE] \
-callback UiExamineCB \
-autoLock UiExamineCB]
VxSetVar $parent examine $examine
# If there is no "Host Menu" then "Exit" will need to be part
# of this menu (below a separator)
if {! $appvals(openhost)} {
VtSeparator $fileMenu.s2
set exitMenu $fileMenu
# exit button
VtPushButton $exitMenu.exit \
-label [IntlMsg EXIT] \
-mnemonic [IntlMsg EXIT_MN] \
-shortHelpCallback SaShortHelpCB \
-shortHelpString [IntlMsg EXIT_SH [list $appval
s(title)]] \
-callback UiCloseCB \
-autoLock UiCloseCB
}
}
}
#====================================================================== XXX ===
# UiBuildOptionsMenu
#
# Build the option menu including:
# o short help toggle
#------------------------------------------------------------------------------
proc UiBuildOptionsMenu {form} {
global appvals
# Define the Pulldown itself
set optionMenu [VtPulldown $form.optionMenu \
-label [IntlMsg OPTIONS] \
-mnemonic [IntlMsg OPTIONS_MN] \
]
# menu items
# short help
SaShortHelpLoad $appvals(client)
SaShortHelpMenuOptions $optionMenu
# toolbar
if {$appvals(toolbar)} {
UiToolBarBuildMenuOptions $optionMenu
}
VxSetVar $form optionMenu $optionMenu
return $optionMenu
}
#====================================================================== XXX ===
# UiBuildViewMenu
#
# Build the view menu including:
# o auto refresh parameters
#------------------------------------------------------------------------------
proc UiBuildViewMenu {form} {
global appvals
# in the template, this view menu is defined only for auto refresh
# delete the following check if view is desired regardless
if {!$appvals(autorefresh)} {
return {}
}
set viewMenu [VtPulldown $form.viewMenu \
-label [IntlMsg VIEW] \
-mnemonic [IntlMsg VIEW_MN] \
]
VxSetVar $form viewMenu $viewMenu
# add the auto refresh menu options
if {$appvals(autorefresh)} {
set intervalCB {}
# Allow user to select auto refresh interval?
if {$appvals(autorefreshcust)} {
# use default callback in package
set intervalCB \
[list SaAutoRefreshIntervalCB \
$appvals(autorefreshmin) \
$appvals(autorefreshmax) \
]
}
VtSeparator $viewMenu.s1
SaAutoRefresh UiRefreshCB \
$viewMenu \
"data" \
SaShortHelpCB \
$intervalCB
SaAutoRefreshLoad $appvals(client)
}
}