rpanel (version 1.1-4)

rp.notebook: Define a notebook within an rpanel

Description

A tabbed notebook, the location of which is defined by pos, is created within an rpanel. Further widgets, grids or even notebooks can then be placed within the notebook.

Usage

rp.notebook(panel, tabs, tabnames=tabs, width = 600, height = 400, pos = NULL, 
  foreground = NULL, background = "lightgray", font = NULL, 
  parentname = deparse(substitute(panel)),
  name = paste("notebook", .nc(), sep = ""), ...)
rp.notebook.raise(panel, parentname, label)

Arguments

panel

the panel in which the notebook should appear.

tabs

this is a vector of the names to appear on the tabs

tabnames

this is a vector of the labels to be used internally - used by rp.notebook.raise

width

the width, in pixels, of the notebook

height

the height, in pixels, of the notebook

pos

the position of the notebook. see rp.pos

foreground

this sets the colour of text e.g. "navy"

background

this sets the background colour of text e.g. "white"

font

this sets the text font e.g. "Arial"

parentname

this specifies the widget inside which the notebook should appear.

name

the name of the widget - this is used by rp.widget.dispose

label

the name of the tab which is to be raised

...

...

Details

The role of this function is to specify a notebook. Nesting of notebooks is permitted. rp.notebook.raise is used to bring the contents of a particular tab to the foreground.

References

rpanel: Simple interactive controls for R functions using the tcltk package. Journal of Statistical Software, 17, issue 9.

Examples

Run this code
# NOT RUN {
panel <- rp.control(title="Notebook example with two notebooks")
rp.notebook(panel, c("File", "Edit"), width=600, height=400,
            pos=list(row=0, column=0), background="lightgray",
            font="Arial", name="n1")
rp.notebook.raise(panel, "n1", "Edit")
rp.button(panel, function(panel){
	                rp.messagebox("Button pressed!"); panel },
	                "Test this", parentname="Edit")
rp.messagebox("A second tabbed notebook can be added to the same window.")
rp.notebook(panel, c("A tab 1", "A tab 2"), width=200, height=200,
            pos=list(row=1, column=1), background="Navy", foreground="White")
rp.messagebox("A tabbed notebook can be placed inside a tabbed notebook.")
rp.notebook(panel, c("Tab within tab", "Another tab"),
            width=200, height=100, parentname="File", name="n3")
rp.notebook.raise(panel, "n1", "File")
rp.notebook.raise(panel, "n3", "Another tab")
# }

Run the code above in your browser using DataLab