Class ::tycho::ButtonBox


Inherits: ::tycho::TWidget - Source File - Contents: itk_options - public methods - protected variables - protected common
This class implements a reasonably useful button box widget. It is based on the grid geometry manager, and so allows you to add buttons at arbitrary locations if you want to.

Note that this widget is fairly simple, and that the following options should not be changed once any buttons have been created: -statusbar, -columns.

The buttons are not necessarily evenly spaced. I thought the grid geometry manager would do this but apparently it doesn't. It would be nice if there were an automatic way of getting all buttons the right width, but right now there just isn't...

FIXME: Figure out if it's possible to bind to a window mapping event and adjust the column -minsize option based on the measured button widths.


Itk_options

-columns 0
The number of columns in the grid. Zero means a horizontal layout, gives a vertical layout, any other number gives a rectangular layout. Note: Cannot be reliably changed once buttons have been added.
-padx 11
The horizontal padding of buttons.
-pady 4
The vertical padding of buttons.
-spacingx 0
The horizontal padding between buttons.
-spacingy 0
The vertical padding between buttons.
-font [::tycho::font
The font to use for the buttons.
-ringwidth 4
The width of the default ring.
-statusbar
The status bar to print help info to.
-buttonwidth 8
The width of the buttons.

Public constructs

Public Methods

add tag args
Add a button to the button box. Any legal option for regular Tk buttons are allowed, except for the ones overridden by this widget: -font, -padx, -pady. In addition, the following options are allowed:

If either is given, then both of the row and column buttonopts must be given. If neither is given (what you would usually do), then the grid fills up from left to right and top to bottom.

buttoncget tag option
Get a configuration option of a button.
buttonconfigure tag {option {}} args
Set the configuration options of a button. If only one argument is supplied, return all the current option values as an option value list. If the second argument is supplied, return a single option-value pair. Otherwise set the given options to the given values.

Note: if you want to change the position of a button, you can do so by using these methods. However, you still have to ensure that the button is moved to a position notr already occupied.

default args
Set the default ring around the specified button and bind the return key to its command.

With no arguments, this method returns the current default button. If the argument is the null string, then the default ring is removed.

delete tag
Delete the specified button.
invoke tag
Invoke the command of a specified button.
location tag
Get the location of the specified button.

Protected constructs

Protected Variables

currentColumn 0
The current column.
currentRow 0
The current row.
defaultButton
The default button.
_row
The row of each button.
_column
The column of each button.
_description
The description of each button.

Protected Common

localoptions -row -column -description
The names of the locally-stored options.

Index of classes



Author: John Reekie
Version: @(#)ButtonBox.itcl 1.4 11/19/96
Copyright: (c) 1995-1996 The Regents of the University of California.