Learn R Programming

gWidgets2 (version 1.0-9)

glayout: Constructor for grid layout container

Description

The grid layout container uses matrix notation to position its child components. This allows one to align widgets both horizontally and vertically, as desired. There is some support for matrix methods, such as dim and [ to reference the child objects.

The [ method for the grid layout allows one to reference the child objects by index. The return value is non standard. It may be the item, a list (if one dimensonaL) or an array. The list format is convenient to refer to all the child objects in a column.

The matrix notation allows for spanning of multiple rows and or columns, but no holes. The ... argument is used to pass in values for expand, fill, anchor (see the add method of ggroup) for their meaning).

Usage

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

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

# S3 method for GLayout [(x, i, j, ..., drop = TRUE)

# S3 method for GLayout [ (x, i ,j, ...) <- value

Arguments

homogeneous

are cells all the same size

spacing

between cell spacing

container

A parent container. When a widget is created it can be incorporated into the widget heirarchy by passing in a parent container at construction time. (For some toolkits this is not optional, e.g. gWidgets2tcltk or gWidgets2WWW2.)

...

These values are passed to the add method of the parent container. Examples of values are expand, fill, and anchor, although they're not always supported by a given widget. For more details see add. Occasionally the variable arguments feature has been used to sneak in hidden arguments to toolkit implementations. For example, when using a widget as a menubar object one can specify a parent argument to pass in parent information, similar to how the argument is used with gaction and the dialogs.

toolkit

Each widget constructor is passed in the toolkit it will use. This is typically done using the default, which will lookup the toolkit through guiToolkit.

x

object

i

row index

j

column index

drop

drop return type?

value

constructor for a widget using this object as the parent container

See Also

gformlayout for a more convenient means to layout forms.

Examples

Run this code
# NOT RUN {
w <- gwindow("glayout example", visible=FALSE)
g <- gvbox(container=w)
lyt <- glayout(container=g)
lyt[1,1] <- "a label"
lyt[1,2] <- gedit("A widget", container=lyt)
lyt[2, 1:2] <- gcombobox(state.name, cont=lyt)
g1 <- ggroup(container=g)
addSpring(g1)
gbutton("values", container=g1, handler=function(h, ...) {
  print(sapply(lyt[,2], svalue))
})
visible(w) <- TRUE

# }

Run the code above in your browser using DataLab