gborderlayout: A "border" layout is a layout where up to four satellite...

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/gborderlayout.R

Description

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.

Usage

1
2
3
gborderlayout(container = NULL, ..., width = NULL, height = NULL,
  ext.args = NULL, title = list(), panels = c("center", "north", "south",
  "east", "west"), collapsible = list())

Arguments

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.

title

a list with named components from c("center","north", "south", "east", "west") allowing one to specify titles (as length-1 character vectors) of the regions. The default is no title. A title may be added later by adding a gframe instance, but that won't work well with a collapsible panel.

panels

The panels to be set up.

collapsible

a list with named components from c("center","north", "south", "east", "west") allowing one to specify through a logical if the panel will be collapsible, similar to gexpandgroup. The default is FALSE

Details

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.

Value

a GBorderLayout reference class object

Note

gpanedgroup does not sit nicely within a gnotebook container, avoid trying this.

Author(s)

john verzani

See Also

gpanedgroup is a two-panel border layout with just an "east" or "south" satellite panel configured.

Examples

 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)

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