- NAME
- MainFrame
- Manage toplevel with menu, toolbar and statusbar
- CREATION
- MainFrame pathName ?option value...?
- WIDGET-SPECIFIC OPTIONS
- WIDGET COMMAND
- pathName addindicator
?arg...?
- pathName addtoolbar
- pathName cget
option
- pathName configure
?option? ?value option value ...?
- pathName getframe
- pathName getindicator
index
- pathName gettoolbar
index
- pathName showstatusbar
name
- pathName showtoolbar
index
bool
DESCRIPTION
MainFrame manage toplevel to have:
- simple menu creation, with automatic accelerator bindings and
DynamicHelp association,
- one or more toolbar that user can hide,
- a status bar, displaying a user message or a menu description, and optionnaly a
ProgressBar.
WIDGET-SPECIFIC OPTIONS
- -height
-
Specifies the desired height for the user frame in any of the forms acceptable to
Tk_GetPixels. If this option is less than or equal to zero (the default) then the window
will not request any size at all.
- -menu (read-only)
-
This option describes the menu. This is a list of the following form:
{menuname tearoff menuentries...}
where menuname is the name of the menu, tearoff specifies if menu has
tearoff entry, and menuentries is a list where each element describe one entry.
Entry format is:
- for a separator:
{separator}
- for a command:
{command menuname ?command? ?description? ?accelerator? ?useropt?}
- for a check button:
{checkbutton menuname ?command? ?description? ?variable? ?useropt?}
- for a radio button:
{radiobutton menuname ?command? ?description? ?variable? ?value? ?useropt?}
- for a cascad menu:
{cascad menuname ?command? tearoff menuentries}
where:
command specifies a Tcl command to execute when the menu entry is invoked.
description specifies a string for DynamicHelp.
accelerator specifies a key sequence.
variable specifies a variable associated to the check or the radio button.
value specifies a value associated to the radio button.
menuentries specifies the entries of the cascad menu.
useropt specifies of list of additionnal options for the entry (see menu add command).
Each value enclosed by ? are optional and defaulted to empty string, but must be
provided if one or more following options is required or not empty.
If menuname contains a &, the following character is automatically converted
to the corresponding -underline option of menu add command.
Example:
{"&File" 0 {
{command "&New" Menu::new "Create a new document" {Control n}}
{command "&Open..." Menu::open "Open an existing document" {Control o}}
{command "&Save" Menu::save "Save the document" {Control s}}
{cascad "&Export" 0 {
{command "Format &1" {Menu::export 1} "Export document to format 1"}
{command "Format &2" {Menu::export 2} "Export document to format 2"}}
}
{separator}
{command "E&xit" Menu::exit "Exit the application"}}
"&Options" 0 {
{checkbutton "Toolbar" {MainFrame::showtoolbar $Menu::_mainframe toolbar $Menu::_drawtoolbar} "Show/hide toolbar" Menu::_drawtoolbar}}
}
- -separator (read-only)
-
Specifies if separator should be drawn at the top and/or at the bottom of the user window.
Must be one of the values none, top, bottom or both.
It depends on the relief of subwidgets of user window.
- -textvariable
-
Specifies the textvariable option for the label of the status bar.
DynamicHelp description
of menu entries are mapped to this variable at the creation of the MainFrame.
If this variable is changed by MainFrame::configure, menu description will
not be available.
You change the text of the label by modifying the value of the variable.
- -variable
-
Specifies the variable option for the ProgressBar
of the status bar.
- -width
-
Specifies the desired width for the user frame in any of the forms acceptable to
Tk_GetPixels. If this option is less than or equal to zero (the default) then the window
will not request any size at all.
WIDGET COMMAND
- pathName addindicator
?arg...?
-
Add an indicator box at the right of the status bar. Each indicator are added from left
to right. An indicator is a Tk label widget configured with option-value pair
given by ?arg...?. -relief and -borderwidth options are respetively
defaulted to sunken and 1. Returns the pathname of the created label.
- pathName addtoolbar
-
Add a toolbar to the MainFrame. Returns the pathname of the new window where to place
toolbar items.
- pathName cget
option
-
Returns the current value of the configuration option given by option.
Option may have any of the values accepted by the create command.
- pathName configure
?option? ?value option value ...?
-
Modify the configuration options of the widget.
Option may have any of the values accepted by the create command,
except those who are read-only.
- pathName getframe
-
Returns the pathname of the user window.
- pathName getindicator
index
-
Returns the pathname of the indexth added indicator.
- pathName gettoolbar
index
-
Returns the pathname of the indexth added toolbar.
- pathName showstatusbar
name
-
name is one of none, status or progression.
Use none to hide the status bar, status to display the label only, or
progression to display the label and the
ProgressBar.
- pathName showtoolbar
index
bool
-
Hide if bool is 0, or show if bool is 1 the indexth added toolbar.
To prevent your toplevel from resizing while hiding/showing toolbar,
do [wm geometry $top [wm geometry $top]] when it is managed.