R: A container for aligning widgets in a table

glayout {gWidgets} | R Documentation

## A container for aligning widgets in a table

### Description

A container for laying out widgets in a table. The widgets are added using matrix notation (`[i,j]<-`).

### Usage

    glayout(homogeneous = FALSE, spacing = 10, container = NULL, ..., toolkit = guiToolkit())

### Arguments

`homogeneous` | A logical indicating if the cells are all the same size
`spacing` | Spacing in pixels between cells
`container` | Optional container to attach widget to.
`...` | Passed to `add` method of container
`toolkit` | Which GUI toolkit to use

### Details

Widgets are added using matrix notation. A widget can span several cells, for instance `obj[1:2,2:3] <- widget` would place the widget in the first and second rows and second and third columns. The matrix notation is to specify the space allocated to the widget.

For `gWidgetstcltk`, it is necessary for a child widget to have the layout object as its parent container and to call the `[<-` method to add the widget. (See the example.)

As a convenience, if the value to be assigned is a character it will be turned into a `glabel` object before being added.

Like `ggroup`, the extra argument `expand` can be used to force the widget to expand to fill all the space allocated to it.

Like `ggroup`, the extra argument `anchor` can by used to anchor the child within the space allocated when this space islarger than needed by the widget. This is specified as a pair of values from -1,0,1 to indicating the x and y positioning of the widget within the cell.

Like `ggroup`, the extra argument `fill` can by used when `expand` is given, but not `anchor`, to have the widget expand in the `x` direction, the `y` direction, or `both` (the default). (Toolkit specific).

The method `[` can be used to subset. In the simplest usage, it returns the item at index i,j. (The item at i,j may be in other cells too. The return value is a gwidget if 1x1, a list if 1xn or mx1 (n>1), or a mxn matrix of items.

### Examples

    ## Not run:
      ## show part of mtcars dataframe in a layout
      w <- gwindow("glayout example")
      tbl <- glayout(container = w)
      tbl[1,1] <- "a label"
      ## need container argument in gWidgetstcltk, gWidgetsRwxwidgets
      ## so we always use it.
      tbl[1,2, expand = TRUE] <- gedit("edit here", container=tbl)
      tbl[2,1, anchor = c(-1,-1)] <- glabel("ll", container = tbl)

      ## extraction:
      tbl[1,1] # glabel instance
      tbl[1,2] # gedit instance, ...

    ## End(Not run)

[Package gWidgets version 0.0-54 Index]