Writing a SCOadmin manager

Building the main form

You should bring up the main form as soon as possible so the user has a timely response when starting the manager. You can then do checks and fetch data and keep the user apprised of the startup process with 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) 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 UiWidgetSet vtMain $vtMain UiDefaultFormSpacingSet $vtMain SaCharmSetMaxFormDimensions $vtMain

# Build pulldown menus set menuBar [UiBuildMenus $vtMain] UiWidgetSet menuBar $menuBar

# Build the toolbar if {[VtInfo -charm]} { set topSide $menuBar } else { if {$appvals(toolbar)} { set toolbar [UiBuildToolBar $vtMain $menuBar] #VtSetValues $toolbar -topSide $menuBar set topSide $toolbar } }

# Main form label (vs. title) set mainlabel [VtLabel $vtMain.mainlabel \ -label "$appvals(title) on $appvals(managedhost)"] UiWidgetSet mainlabel $mainlabel

# TODO: build main screen widgets here. # Basic drawnlist is provided as a sample # Pass main form and widget just above for attachments 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] } UiWidgetSet statusBar $statusBar # Connect main screen widget bottom to statusbar VtSetValues $mainList -bottomSide $statusBar

# Display the main form and lock it VtShow $vtMain UiLock }

Next topic: Dimensions, borders, and alignment
Previous topic: Help book

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