### NAME

ResizeButs - Create and manipulate ResizeButs widgets

### SYNOPSIS

ResizeButs pathName ?options?

### STANDARD OPTIONS

-background or -bg, background, Background
-borderwidth or -bd, borderWidth, BorderWidth
-cursor, cursor, Cursor
-font, font, Font
-foreground or -fg, foreground, Foreground
-height, height, Height
-highlightcolor, highlightColor, HighlightColor
-highlightthickness, highlightThickness, HighlightThickness
-orient, orient, Orient
-relief, relief, Relief
-takefocus, takeFocus, TakeFocus
-width, width, Width

### WIDGET-SPECIFIC OPTIONS

Command-Line Name: -orderbutton
Database Name:
Database Class:
  This is a two-item list. The first item is the index number of the button that will initially be returned as an argument to the procedure specified for -ordercommand. The ResizeButs widget is typically used as headings to columns of data, and this button would be the heading of the column that the data is initially ordered by. The second item in the list can be either "increasing" or "decreasing." This is the intial order of the column and this will also be sent as an argument to the -ordercommand procedure.

Command-Line Name: -ordercommand
Database Name: command
Database Class: Command
  This specifies a procedure which will be performed everytime one of the ResizeButs is pressed. Two arguments will be appended. The first one is the index of the button which was pressed. The second one is either "increasing" or "decreasing." These will alternate each time the same button is pressed. This procedure is typically used to reorder data in columns or rows in an increasing or decreasing order.

Command-Line Name: -pressrelief
Database Name: relief
Database Class: Relief
  This accepts the same types as the standard relief option. However, this relief will only be applied as the button is pressed.

Command-Line Name: -resizecommand
Database Name: command
Database Class: Command
  This specifies a procedure which will be performed as the width or height of a button is interactively dragged. It is done everytime a Motion event is registered while dragging the button. This procedure will typically be used to resize any widgets used as columns underneath the ResizeButs headings. A two-item list will be appended. The first item will be the index of the button being resized, and the second item will be its width, if -orient is "horizontal," or its height if -orient is "vertical."

Command-Line Name: -scrollcommand
Database Name: command
Database Class: Command
  Specifies the prefix for a command used to communicate with scrollbars. When the view in the widget's window changes (or whenever anything else occurs that could change the display in a scrollbar, such as a change in the total size of the widget's contents), the widget will generate a Tcl command by concatenating the scroll command and two numbers. Each of the numbers is a fraction between 0 and 1, which indicates a position in the widget. 0 indicates the beginning of the first button, 1 indicates the end of the last button, .333 indicates a position one third the way through the scrollable region, and so on. The first fraction indicates the first information in the widget that is visible in the window, and the second fraction indicates the information just after the last portion that is visible. The command is then passed to the Tcl interpreter for execution. Typically the scrollcommand option consists of the path name of a scrollbar widget followed by ``set'', e.g. ``.x.scrollbar set'': this will cause the scrollbar to be updated whenever the view in the window changes. If this option is not specified, then no command will be executed.

Command-Line Name: -scrollincrement
Database Name:
Database Class:
  Specifies an increment for scrolling, in any of the usual forms permitted for screen distances. If the value of this option is greater than zero, the view in the window will be constrained so that the view is always an even multiple of scrollincrement; furthermore, the units for scrolling (e.g., the change in view when the arrows of a scrollbar are selected) will also be scrollincrement. If the value of this option is less than or equal to zero, then scrolling is unconstrained.

Command-Line Name: -showcommand
Database Name: command
Database Class: Command
  This specifies a procedure which will be performed every time the -show option is changed on a button. This is typically done by the user through the pop-up menu. If the button is unmapped, so as to change the -show option to 0, the arguments to the procedure will be appended with the button index followed by "0". If the button is being mapped, so as to change the -show option to "1", the procedure will be appended with the button index followed by the size of the button in the direction of the orientation of the widget.

Command-Line Name: -showmenu
Database Name:
Database Class:
  This can be either a 0 or 1 to allow the user to select from a popup menu upon right mouse clicking over any of the buttons. Selecting in the popup menu changes the -show option so as to map or unmap the selected button. Setting -showmenu to 1 allows the popup menu to be posted.

Command-Line Name: -showtriangle
Database Name:
Database Class:
  This can be either a 0 or 1 to turn on or off a triangle which will display on the orderbutton, indicating the increasing or decreasing nature of the button.

Command-Line Name: -side
Database Name:
Database Class:
  This can be "left," "right," "top," "bottom," or "both." This is the side of the mouse pointer where button resizing will occur. For a horizontal orientation, "left" and "right" are used. For a vertical orientation, "top" and "bottom" are used. Both orientations can use "both." This option cannot be configured after creation.

### DESCRIPTION

The ResizeButs command creates a new window (given by the pathName argument) and makes it into a ResizeButs widget. Additional options, described above, may be specified on the command line to configure aspects of the ResizeButs widget such as its colors and 3-D relief. The ResizeButs command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist.

The ResizeButs widget grids multiple buttons in a horizontal or vertical orientation. The buttons can be interactively resized in the direction of their orientation by left mouse clicking and dragging a button border while the cursor is displayed as a double-arrow. When the cursor is not displayed as a double-arrow, the underlying button will be pressed when the left mouse button is pressed over it. This widget works well as a heading to columns or rows of widgets, such as tkTable, in order to control the widget sizes and order of data contained within. This is done by configuring the -resizecommand and -ordercommand of the ResizeButs widget. If the -showmenu option is set to 1, then right mouse clicking on any of the buttons will display a menu which will allow the user to turn certain buttons on or off. The change in visibility of selected buttons through this method can be communicated with columns or rows of widgets through the -showcommand procedure.

### INDICES

Buttons are specified with index numbers. The first button is always index 0.
Any place where an index is required as an argument, the following forms may be used:

integer
  Any numerical integer with an optional "-" sign in front.

end
  The rightmost button for a horizontal orientation. The bottom button for a vertical orientation.

last
  Same as end.

@coord
  Coord is the pixel coordinate contained by the button in the local coordinate system of the ResizeButs widget. For a horizontal orientation, it is the x-coordinate. For a vertical orientation, it is the y-coordinate.

text
  The first button which contains the string configured to the -text option for the button. Glob characters are allowed.

### WIDGET COMMAND

The ResizeButs command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form:

    pathName option ?arg arg ...?

Option and the args determine the exact behaviour of the command. The following widget commands are possible for the ResizeButs widgets:

pathName add ?option value ...?
  Create a new button in pathName. The option-value argument pairs provide additional information to control the new button. The following options are supported:

  -command procedure
    Procedure will be performed everytime the button is released.

  -height distance
    Specifies the minimum height of the button in any of the usual forms permitted for screen distances. Interactive dragging will not be constrained by this. This has no effect if -orient is set to horizontal, where the -height must be set for the entire widget.

  -image name
    Name specifies a tcl image. If -image and -text are both specified, the image will always appear to the left of the text.

  -lockshow boolean
    Boolean can take the values 0 or 1. If this option is set to 1, the user will not be able to map or unmap the button from the popup menu. Setting -lockshow to 0 allows the user to map or unmap the button from the popup menu. Regardless of this setting, the button can still be mapped or unmapped by changing the -show option from the command line.

  -show boolean
    Boolean can take the values 0 or 1. If this option is set to 0, the button will not be mapped. Setting it to 1 maps the button. If -showmenu is set to 1, the user will be able to alter this option by selecting in the popup menu.

  -state state
    State can take the values normal or disabled. While disabled is set, the button cannot be pressed, but it can still be resized.

  -text string
    Specifies a string to be displayed in the button. If -image and -text are both specified, the image will always appear to the left of the text.

  -width distance
    Specifies the minimum width of the button in any of the usual forms permitted for screen distances. Interactive dragging will not be constrained by this. This has no effect if -orient is set to vertical, where the -width must be set for the entire widget.

pathName cget option
  Returns the current value of the configuration option given by option. Option may have any of the values accepted by the ResizeButs command.

pathName configure ?option value ...?
  Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName. If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the ResizeButs command.

pathName delete index1 ?index2?
  Deletes the specified button or buttons. If only index1 is specified, then only the one button index is deleted. If index2 is also specified, then all buttons in between including index1 and index2 buttons will be deleted. All buttons will be repositioned to fill the missing space.

pathName index ?-strict? ?-shown? index
  Returns the numerical index number of the button index. Index can take any of the forms described in the INDICES section. If the -strict option is used, and index is an integer index number or coordinate that is out of range, then the command will return -1. If -strict is not specified, and index is out of range then the closest index number will be returned. If the button index does not exist, then -1 will be returned. If the -shown option is used, the index of the visible button position will be returned. These buttons have a -show value of 1. If the button is not shown, then the current visible index of the position it will replace if immediately mapped is returned.

pathName insert index ?option value ...?
  Creates a new button and places it before the button specified by index. If index is end or last, the new button will be appended to the end. The same option value pairs are accepted as with the pathName add command.

pathName invoke
  Evaluates the -ordercommand. Two arguments will be appended. The first one is the index of the current -orderbutton. The second one is either "increasing" or "decreasing."

pathName itemcget index option
  Returns the value of the specified option for the specified button index. The option can be any of those used by the pathName add command.

pathName itemconfigure index ?option value ...?
  Query or modify the configuration options of the specified button index. This works just like the pathName configure command except the valid options are only those used by the pathName add command.

pathName iteminvoke index
  Evaluates the -command of the specified button index.

pathName setfocus index
  Sets the keyboard focus on the specified index button. Pressing the Enter key will press the button with the current focus.

pathName view
  Returns a list containing two elements. Each element is a real fraction between 0 and 1; together they describe the span that is visible in the window. For example, if the first element is .2 and the second element is .6, 20% of the scrollable button area is off-screen to the left (for -orient = horizontal) or to the top (for -orient = vertical), the middle 40% is visible in the window, and 40% of the scrollable button area is off-screen to the right (for -orient = horizontal) or bottom (for -orient = vertical). These are the same values passed to scrollbars via the -scrollcommand option.

pathName view moveto fraction
  Adjusts the view in the window so that fraction of the total width of the scrollable button area is off-screen to the left (for -orient = horizontal) or top (for -orient = vertical). Fraction must be a fraction between 0 and 1.

pathName view scroll number what
  This command shifts the view in the window according to number and what. Number must be an integer. What must be either units or pages. If what is units, the view adjusts in units of the -scrollincrement option, if it is greater than zero, or in units of one-tenth the window's width (for -orient = horizontal) or height (for -orient = vertical) otherwise. If what is pages then the view adjusts in units of nine-tenths the window's width. If number is negative then information farther to the left (for -orient = horizontal) or top (for -orient = vertical) becomes visible; if it is positive then information farther to the right (for -orient = horizontal) or bottom (for -orient = vertical) becomes visible.

pathName visible
  Returns a list of all the visible indices, in order. These button indices have the -show option configured to 1.