gstackwidget: Constructor for a stack of widgets

Description Usage Arguments Examples

View source: R/gstackwidget.R

Description

This widget is like a notebook – it holds a stack of pages, but does not provide the tabs to work with. Most methods are inherited from gnotebook's.

Usage

1
2
3
gstackwidget(container = NULL, ..., toolkit = guiToolkit())

.gstackwidget(toolkit, container = NULL, ...)

Arguments

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, and occasionally have been used to sneak in hidden arguments to toolkit implementations.

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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
w <- gwindow("stack widget", visible=FALSE)
add_page <- function(cont, i) {
  g <- gvbox(container=cont)
  glabel(sprintf("page %s",i), container=g)
  bg <- ggroup(container=g); addSpring(bg)
  lb <- gbutton("Previous", container=bg, handler=function(h,...) {
    svalue(cont) <- max(1, i - 1)
  })
  rb <- gbutton("Next", container=bg, handler=function(h,...) {
    svalue(cont) <- min(i + 1, length(cont))
  })
}
sw <- gstackwidget(cont=w)
sapply(1:5, add_page, cont=sw)
visible(w) <- TRUE

## End(Not run)

gWidgets2 documentation built on Jan. 11, 2022, 1:07 a.m.