R functions to build a GUI window

Share:

Description

Function that wraps the result of mapFuncToWidget as an R\ function that pop us a widget representing the function.

Usage

1
  makeWidgetCmd(frmTitle,fun,baseFrame=.TkRoot,STORE="ff",GRAB=TRUE)

Arguments

frmTitle

title of the GUI window.

fun

function to map.

baseFrame

tcltk parent frame of the GUI window for the function fun.

STORE

A string. Name of the place where to store details needed by the GUI to perform the execution.

GRAB

Logical. When TRUE disable input in any other window.

Details

The main use of this function is to obtain a function that called creates a widget that allows the parameter input and execution of function fun. It also adds a Quit fun function to close the widget.

Value

This function returns an R\ function.

Author(s)

Jorge Luis Ojeda Cabrera (jojeda@unizar.es).

See Also

miniGUI, makeWidgetCmd, miniGUIgetFormals, addMenusCmd, tcltk.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  require(tcltk)
  ##
  ##  a simple example
  ## 
  g <- function(a=1,b=rnorm) {cat("--g--");paste("g(a,b)=",a+b(a))}
  h <- function(a=1,b=3,c=3) {cat("--h--");paste("h(a,b,c)=",a+b+c)}
  ## create functions
  gg <- makeWidgetCmd("Hay it is g !!",g,GRAB=FALSE)
  hh <- makeWidgetCmd("Hay h here !!",h,GRAB=FALSE)
  ## calling them
  gg()
  cat("\nClose it before calling hh(), they sharer parameters a and b!!")
  hh()
  ##
  ##  simple example(continuation)
  ##
  ## to be able to use both at the same time:save info for h in other place 
  hh <- makeWidgetCmd("Hay h here !!",h,STORE="h")
  gg()
  hh()