glayout: A table container

Description Usage Arguments Details Value Examples

View source: R/glayout.R

Description

A table container allows one to organize child widgets in a grid using matrix notation to indicate where the child should be placed. The basic assignment is: tbl[i,j] <- gbutton("asdf", cont=tbl). The tbl object is on the right side, so the widget has a toplevel and on the left to specify how the layout will occur. One can specify i and j as a range of values, or even empty

Usage

1
2
glayout(homogeneous = FALSE, spacing = 2, container = NULL, ...,
  width = NULL, height = NULL, ext.args = NULL)

Arguments

homogeneous

equal sized columns/rows?

spacing

between cell spacing

container

A parent container. In gWidgetsWWW2 a parent container is not optional (though it can be substituted with the parent argument in some circumstances). The parent specifies the widget heirarchy and the ... argument is used to pass along arguments to layout the child component in the parent container. Typically, these are passed to the add method of the parent container.

...

Used to pass along argument to the parent container's add method and possible other arguments to the underlying ference class constructors.

width

width in pixels of component. Sizing in gWidgetsWWW2 is sometimes necessary as the arguments expand and fill are not well implemented.

height

height in pixels of the component.

ext.args

The contructors of gWidgetsWWW2 ultimately call an Ext constructor. The options passed to the Ext constructor may be added to or overridden by use of this argument. Values are passed in as named list components and with values converted into JavaScript objects by asJSObject.

Details

The layout is only finalized after call the visible<- method with a value of TRUE. One adds all the desired children, then calls this method. It is at this point the widget is rendered, so if the widget is added to a box container, say, to which other components are added this one will appear after any others that had been added. (So pretty much, add the children then call visible.)

Value

an ExtContainer object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
w <- gwindow("grid layout example")
sb <- gstatusbar("Powered by gWidgetsWWW and Rook", cont=w)
tbl <- glayout(cont=w)
tbl[1,1, anchor=c(1,0)] <- "Name"  ## a character maps to a label
tbl[1,2] <- gedit("", cont=tbl) ## tbl needed on right side too
tbl[2,1, anchor=c(1,0)] <- "Rank"
tbl[2,2] <- gedit("", cont=tbl)
tbl[3,2] <- gbutton("click", cont=tbl, handler=function(h,...) {
  msg <- whisker.render("{{name}} is a {{rank}}",
           setNames(lapply(tbl[,2], svalue)[1:2], c("name", "rank")))
  galert(msg, parent=w)
})
visible(tbl) <- TRUE ## This line is needed!

gWidgetsWWW2 documentation built on May 2, 2019, 6:10 p.m.