|
|
The main form should be displayed as soon as possible to ensure a timely response for the user. You can then check authorizations, fetch data, and display status messages while the main form is in a locked state.
Template startup procedure: UiStart
proc UiStart {} {
global appvals
# Open/connect to widget server
set vtApp [VtOpen $appvals(client)]
set appvals(vtApp) $vtApp
VtSetAppValues $vtApp \
-versionString "$appvals(title) $appvals(version)" \
-errorCallback {SaUnexpectedErrorCB {}}
if {$appvals(openhost)} {
set title \
"$appvals(title) [IntlMsg ON] [SaHostExtractSystemName $appvals(managedhost)]"
} else {
set title "$appvals(title)"
}
# Create main dialog
set vtMain [VtFormDialog $vtApp.main \
-title $title \
-wmShadowThickness 0 \
-wmCloseCallback UiCloseCB]
set appvals(vtMain) $vtMain
VxSetVar appvals(vtMain) vtMain $vtMain
UiDefaultFormSpacingSet $vtMain
SaCharmSetMaxFormDimensions $vtMain
# Build pulldown menus
set menuBar [UiBuildMenus $vtMain]
VxSetVar $appvals(vtMain) menuBar $menuBar
# Build the toolbar
if {! [VtInfo -charm]} {
if {$appvals(toolbar)} {
set toolbar [UiBuildToolBar $vtMain $menuBar]
}
}
# Main form label (vs. title)
set mainlabel [VtLabel $vtMain.mainlabel \
-label "$appvals(title) [IntlMsg ON] $appvals(managedhost)"]
VxSetVar $appvals(vtMain) mainlabel $mainlabel
# TODO: build main screen widgets here.
# Basic drawnlist is provided as a sample
# Pass main form and widget just above for attachments
if {$appvals(who)} {
set mainList [UiBuildMainList $vtMain $mainlabel]
}
# Build the status bar
# Standard SCOadmin status bar pixmap
set logofile {}
# Full pathname for non-SCOadmin status bar pixmap
# set logofile "?"
if {[lempty $logofile]} {
set statusBar [SaStatusBar $vtMain.statusBar 1]
} else {
set statusBar [SaStatusBar $vtMain.statusBar 1 $logofile]
}
VxSetVar $appvals(vtMain) statusBar $statusBar
# Connect main screen widget bottom to statusbar
if {$appvals(who)} {
VtSetValues $mainList -bottomSide $statusBar
}
# Display the main form and lock it
VtShow $vtMain
VtLock
}