Documentation‎ > ‎Containers‎ > ‎

gnocl::box

A widget which arranges its children horizontally or vertically.

Synopsis

gnocl::box [-option value...]

Screenshot

Options

-align 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 integer or one of small, normal or big
Space in pixel between the children and the border of the widget.
-buttonType boolean (default: false)
Whether the box has button type. This cannot be changed after creation.
-children 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 list of strings
List of source targets (e.g. text/plain or application/x-color) which are supported.
-dropTargets list of strings
List of destination targets (e.g. text/plain or application/x-color) which are supported.
-expand 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 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 string (default: "")
The -heightGroup opyion 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 string (default: "")
Plain text to disaplay in the label of the frame.
-labelAlign float (0 lt xAlign lt 1) or one of left, center or right (default: 0)
Alignment of the label.
-labelWidget <widget-id>
Replace the default frame with a custom gnocl::label item. This is enable the frame label to be configured with using the wider range of options available to a gnocl::label object. Most noteable of these is the use of Pango markup strings.
-layout ONE OF 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 string
Name of the widget, can be used to set options in an rc file.
-onDragData 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 substituted:
%w    widget name
%t    time
%T    type of data
-onDropData string (default: "")
Tcl command which is executed if data is dropped on the widget. Before evaluation the following percent strings are substituted:
%w    widget name
%d    data
%l    length of data
%t    time
%T    type of data
%x    x coordinate
%y    y coordinate
-onPopupMenu string (default: "")
Tcl command which is executed if the "popup-menu" signal is received, which is normally the case if the user presses Shift-F10. Before evaluation the following percent strings are substituted: %w by widget name.
-onShowHelp string (default: "")
Tcl command which is executed in the global scope if the "show-help" signal is received, which is normally the case if the user presses F1 or Ctrl-F1. Before evaluation the following percent strings are substituted
%w    widget name
%h    help type: either "whatsThis" or "tooltip"
-orientation ONE OF vertical or horizontal (default: horizontal)
Orientation of the box, i.e. the placement of its children. This cannot be changed after creation.
-padding 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 boolean (default: 1)
Whether or not the item is sensitve to user input.
-shadow ONE OF none, in, out, etchedIn or etchedOut (default: none)
Shadow type of the frame.
-sizeGroup string (default: "")
The -sizeGroup option 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 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 string
Message that appear next to this widget when the mouse pointer is held over it for a short amount of time.
-visible boolean (default: 1)
Whether or not the item is visible.
-widthGroup string (default: "")
The -widthGroup option 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 boolean (default: 0)
Whether the widgets allocate the free space in packing direction (vertical for vertical boxes, horizontal for horizontal boxes ).
-fill 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 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 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.
id remove widget-Id
Remove widget from container. The item is not destroyed and may be added to another container or manipulated off-screen.

Example

set but1 [gnocl::button -text "1"]

set box1 [gnocl::box \
    -label "horizontal" \
    -children $but1]

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
Comments