DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing a SCOadmin manager

Menu bar

Structure the menu bar as follows:

Host Object View Options Help
where Object relates to the object you are managing, such as printers or users.

There are several important conventions for the main screen. A menu bar should contain several standard elements as well as some optional ones depending on the appropriateness to the application.. The current convention is a variation on the File-Edit-View menu headings and functions that is appropriate to managing different system objects. The left-most menu item is often File in Windows applications where a ``file'' is containing data the application displays or edits is the object being operated on. In system administration applications the object being viewed or modified is a user, filesystem, and so on. The functions under this menu usually involve performing some action on an object, saving changes, printing current configuration, printer setup and exiting the application.

Template menu procedure: UiBuildMenus

proc UiBuildMenus {form} {
	global appvals

set menuBar [VtMenuBar $form.menuBar \ -helpMenuItemList [SaHelpGetOptionsList]] UiWidgetSet menuBar $menuBar $form set openhost $appvals(openhost)

if {$openhost} { set hostMenu [VtPulldown $menuBar.hostMenu \ -label [IntlMsg HOST] \ -mnemonic [IntlMsg HOST_NM] \ ] UiWidgetSet hostMenu $hostMenu $menuBar }

# Main object menu set label $appvals(object) set mnemonic $appvals(objectmn) set fileMenu [VtPulldown $menuBar.fileMenu \ -label $label \ -mnemonic $mnemonic \ ] UiWidgetSet fileMenu $fileMenu $menuBar set exitMenu $fileMenu

# open host? if {$openhost} { VtPushButton $hostMenu.openhost \ -label [IntlMsg OPENHOST] \ -mnemonic [IntlMsg OPENHOST_NM] \ -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 }

# examine button set examine [VtPushButton $fileMenu.examine \ -label [IntlMsg EXAMINE] \ -mnemonic [IntlMsg EXAMINE_NM] \ -shortHelpCallback SaShortHelpCB \ -shortHelpString [IntlMsg EXAMINE] \ -callback UiExamineCB \ -autoLock UiExamineCB] UiWidgetSet examine $examine $menuBar

if {$fileMenu == $exitMenu} { VtSeparator $fileMenu.s2 }

# 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"

# view menu for auto refresh? UiBuildViewMenu $menuBar

UiBuildOptionsMenu $menuBar return $menuBar }

Host menu

For a remote-capable application, the first menu should be labeled Host and should contain at least Open Host and Exit menu items. The SCOadmin services library provides a routine for handling the open host task. Use SaOpenHostCB(TCL_ADM) as the callback for Open Host. Alternative methods of selecting hosts are documented in the SaHost(TCL_ADM) and SaOpenHost(TCL_ADM) manual pages.


NOTE: Managers lacking remote capabilities should place Exit in the menu designated for objects.

View menu

The View menu is used to change the data displayed in the main list. Two options that should appear in the menu are Set Auto Refresh and Refresh Now implemented via SaAutoRefresh(TCL_ADM) (if refreshing the view makes sense in your manager).


NOTE: See ``Exiting the application'' for information on storing user preferences, including refresh options.

Template sample code: 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) }

See also:

Options menu

The Options menu should include the menu selections Point Help, and (if appropriate) Toolbar and Customize Toolbar. ``Template procedure: UiToolBarBuildMenuOptions'' demonstrates the use of SaShortHelpLoad(TCL_ADM) to load the stored short help settings and SaShortHelpMenuOptions(TCL_ADM) to construct the menu selection.

``Template procedure: UiBuildOptionsMenu'' includes procedures to build the tool bar menu options.

Template procedure: UiBuildOptionsMenu

   proc UiBuildOptionsMenu {form} {
           global appvals
           set optionMenu [VtPulldown $form.optionMenu \
                   -label  [IntlMsg OPTIONS] \
                   -mnemonic [IntlMsg OPTIONS_NM] \
                   ]
           SaShortHelpLoad $appvals(client)
           SaShortHelpMenuOptions $optionMenu
           if {$appvals(toolbar)} {
                   UiToolBarBuildMenuOptions $optionMenu
           }
           UiWidgetSet optionMenu $optionMenu $form
           return $optionMenu
   }

Template procedure: UiToolBarBuildMenuOptions

proc UiToolBarBuildMenuOptions {menu} {
	global appvals
	if {[VtInfo -charm]} {
		return
	}
	VtSeparator $menu.s1
	if {$appvals(toolbarcust)} {
		set opts {show custom}
	} else {
		set opts {show}
	}
	SaToolbarMenuOptions $menu $opts
}

See also:

Help menu

Use SaHelpGetOptionsList(TCL_ADM) to get a standard list of choices for the Help menu. This provides hooks to the online documentation.

See also:


Next topic: Tool bar
Previous topic: Main window label and title

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