#
Prev |  | Next

# box

## Name

box -- A widget which arranges its children horizontal or vertical.

## Synopsis

box [`-option` `value`...]

## Screenshot

## Options

-align

  type: a list of the horizontal and vertical alignment or one of topLeft, top, topRight, left, center, right, bottomLeft, bottom, or bottomRight (default: center)

  This option influences only the widget given by -children. Alignment of of the widgets given by the -children option in the space allocated in the box.

-borderWidth

  type: integer or one of small, normal or big

  Space in pixel between the children and the border of the widget.

-buttonType

  type: boolean (default: false)

  Whether the box has button type. This cannot be changed after creation.

-children

  type: list-of-widget-IDs (default: "")

  List of IDs of widgets which are placed inside the box. All existing children are removed from the box.

-dragTargets

  type: list of strings

  List of source targets (e.g. text/plain or application/x-color) which are supported.

-dropTargets

  type: list of strings

  List of destination targets (e.g. text/plain or application/x-color) which are supported.

-expand

  type: boolean (default: 0)

  This option influences only the widget given by -children. Whether the widgets allocate the free space in packing direction (vertical for vertical boxes, horizontal for horizontal boxes ).

-fill

  type: float or list of two floats ( 0 lt fill tl 1) (default: {0 1} (horizontal), {1 0} vertical)

  This option influences only the widget given by -children. Determines whether the allocated space is actually used. The values can range from 0 (meaning the child uses its minimum size) to 1 (meaning the child fills all of the available space). If fill is a list, the first value is for the horizontal and the second for the vertical expansion.

-heightGroup

  type: string (default: "")

  heightGroup can be an arbitrary string. All widgets with the same heightGroup request the same height. If packed with the fill flag set, they will have nevertheless different heights.

-homogeneous

  type: boolean (default: 1)

  Whether all children of the box are given equal space. This is only useful if the children are not scaled, i.e. a fill factor other than 0 or 1.

-label

  type: string (default: "")

  Label of the frame.

-labelAlign

  type: float (0 lt xAlign lt 1) or one of left, center or right (default: 0)

  Alignment of the label.

-layout

  type: ONEOF default, spread, edge, start or end (default: default)

  Layout of the buttons in a button box. This option is only valid for boxes of buttonType.

-name

  type: string

  Name of the widget, can be used to set options in an rc file.

-onDragData

  type: string (default: "")

  Tcl command which is executed if data is draged from this the widget to another. This command must return the data to be draged. Before evaluation the following percent strings are substituated: TABLE %% | % %w | widget name %t | time %T | type of data TABLE

-onDropData

  type: string (default: "")

  Tcl command which is executed if data is dropped on the widget. Before evaluation the following percent strings are substituated: TABLE %% | % %w | widget name %d | data %l | length of data %t | time %T | type of data %x | x coordinate %y | y coordinate TABLE

-onPopupMenu

  type: string (default: "")

  Tcl command which is executed if the "popup-menu" signal is recieved, which is normally the case if the user presses Shift-F10. Before evaluation the following percent strings are substituated: %w by widget name.

-onShowHelp

  type: string (default: "")

  Tcl command which is executed in the global scope if the "show-help" signal is recieved, which is normally the case if the user presses F1 or Ctrl-F1. Before evaluation the following percent strings are substituated TABLE %% | % %w | widget name %h | help type: either "whatsThis" or "tooltip" TABLE

-orientation

  type: ONEOF vertical, horizontal (default: horizontal)

  Orientation of the box, i.e. the placement of its children. This cannot be changed after creation.

-padding

  type: integer or one of small, normal or big (default: 0)

  This option influences only the widget given by -children. Space in pixel between the children. This is added to the global -spacing option.

-sensitive

  type: boolean (default: 1)

  Whether or not the item is sensitve to user input.

-shadow

  type: ONEOF none, in, out, etchedIn, etchedOut (default: none)

  Shadow type of the frame.

-sizeGroup

  type: string (default: "")

  sizeGroup can be an arbitrary string. All widgets with the same sizeGroup request the same size. If packed with the fill flag set, they will have nevertheless different sizes.

-spacing

  type: integer or one of small, normal or big (default: normal)

  Space in pixel between the children of the box. This is added to the -padding option, which can be set for each child individually.

-tooltip

  type: string

  Message that appear next to this widget when the mouse pointer is held over it for a short amount of time.

-visible

  type: boolean (default: 1)

  Whether or not the item is visible.

-widthGroup

  type: string (default: "")

  widthGroup can be an arbitrary string. All widgets with the same widthGroup request the same width. If packed with the fill flag set, they will have nevertheless different widths.

## Description

The Gnocl box widget is a combination of the GtkBox (or button box) and, if necessary, the GtkFrame widget. The frame options can only changed via configure if at least one frame option was given on creation of the box. If the children are scaled with the fill option by a factor different then the default or 1, or aligned each child is embedded in a GtkAlignment widget.

## Commands

`id` delete

  Deletes the widget and the associated tcl command.

`id` configure [`-option` `value`...]

  Configures the widget. Option may have any of the values accepted on creation of the widget.

`id` addBegin `list-of-widget-Ids` [`-option` `value`...]

  Add widgets at the left, respectively top side of the box.

  Options

  -expand

    type: boolean (default: 0)

    Whether the widgets allocate the free space in packing direction (vertical for vertical boxes, horizontal for horizontal boxes ).

  -fill

    type: float or list of two floats ( 0 lt fill tl 1) (default: {0 1} (horizontal), {1 0} vertical)

    Determines whether the allocated space is actually used. The values can range from 0 (meaning the child uses its minimum size) to 1 (meaning the child fills all of the available space). If fill is a list, the first value is for the horizontal and the second for the vertical expansion.

  -padding

    type: integer or one of small, normal or big (default: 0)

    Space in pixel between the widgets. This is added to the global -spacing option.

  -align

    type: a list of the horizontal and vertical alignment or one of topLeft, top, topRight, left, center, right, bottomLeft, bottom, or bottomRight (default: center)

    Alignment of of the widgets in the space allocated in the box.

`id` add `list-of-widget-Ids` [`-option` `value`...]

  Synonym for addBegin.

`id` addEnd `list-of-widget-Ids` [`-option` `value`...]

  Add widgets at the right, respectively bottom side of the box. The same options as in the add command are valid.

## Example

    set box1 [gnocl::box -label "horizontal" -children [gnocl::button -text "1"]]
    set box2 [gnocl::box -label "vertical" -orientation vertical]
    $box1 add $box2
    $box2 add [list [gnocl::button -text "2"] [gnocl::button -text "3"]]
    gnocl::window -title "Box" -child $box1 -defaultWidth 100 -defaultHeight 100

results in

## See also

table, paned, notebook, `GtkBox`, `GtkFrame`, `GtkAlignment`

Prev | Home | Next
Commands | Up | expander