Description Usage Arguments Details Value Note Author(s) See Also Examples
View source: R/gborderlayout.R
The gborderlayout container implements a border layout
where up to 4 panels surround a main center panel. The panels may be
configured with a title (like gframe) and may be
collapsible (like gexpandgroup). Both configurations are
done at construction time. The panels only hold one child, so one
would add a container to have more complicated layouts.
1 2 3 |
container |
A parent container. In gWidgetsWWW2 a
parent container is not optional (though it can be substituted
with the |
... |
Used to pass along argument to the parent container's
|
width |
width in pixels of component. Sizing in
gWidgetsWWW2 is sometimes necessary as the arguments
|
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 |
title |
a list with named components from
|
panels |
The panels to be set up. |
collapsible |
a list with named components from
|
To add a child component, one specifies a value of where to
the add method (implicitly called by the constructor, so in
practice this argument is passed through ... by the
constructor). The value of where is one of
c("center","north", "south", "east", "west"). Child
components are added with the "fit" layout, which is basically the
same as specifying expand=TRUE and fill=TRUE, though those
arguments are ignored here.
The satellite panels may be resized through the reference class
method set_panel_size with arguments where and a
numeric dimension.
a GBorderLayout reference class object
gpanedgroup does not sit nicely within a
gnotebook container, avoid trying this.
john verzani
gpanedgroup is a two-panel border layout
with just an "east" or "south" satellite panel configured.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | w <- gwindow("border layout")
#
bl <- gborderlayout(cont=w,
title=list(center="State facts (state.x77)", west="Select a state"),
panels = c("center", "west"),
collapsible=list(west=TRUE)
)
#
tbl <- gtable(data.frame(states=rownames(state.x77), stringsAsFactors=FALSE),
multiple=FALSE,
cont=bl, where="west")
size(tbl) <- c("100%", "100%")
bl$set_panel_size("west", 200)
#
g <- ggroup(cont=bl, where="center", horizontal=FALSE, height=500, width=500)
nms <- colnames(state.x77)
labs <- lapply(seq_along(nms), function(i) {
g1 <- ggroup(cont=g, width=500)
glabel(sprintf("<b>%s</b>",nms[i]), cont=g1)
glabel("", cont=g1)
})
#
update_state_info=function(h,...) {
nm <- svalue(h$obj)
nm <- sample(rownames(state.x77),1)
facts <- state.x77[nm,]
sapply(seq_along(facts), function(i) {
lab <- labs[[i]]
svalue(lab) <- facts[i]
})
}
addHandlerChanged(tbl, handler=update_state_info)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.