glayout {gWidgets} | R Documentation |
A container for laying out widgets in a table. The widgets are added
using matrix notation ([i,j]<-
).
glayout(homogeneous = FALSE, spacing = 10, container = NULL, ..., toolkit = guiToolkit())
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 |
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. There
is no corresponding extraction method via [
.
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.
## 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) ## End(Not run)