miniGUIinputWidget: Entry widgets

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

Description

Function that builds different input methods.

Usage

1
2
3

Arguments

x

An R\ symbol, or numerical or character value. It can also be any R\ expression.

from,to,by

three numerical values.

xx

Any vector of mode numeric or character.

...

Any other sort of present or future parameters.

Details

These functions implements different input methods. In order to work these should appear as the default values of parameters in the definition of the function whose widget is to be built. In this way, the specification of the GUI input method for all the parameters can be done in a simple way by means of the definition if the function. It is worth mentioning that functions defined in this way can use parameters in the ordinary way if a value is provided for them. See the examples below.

In order to map a function onto a widget, mapFuncToWidget uses a tkentry that contains the character conversion of the default value for that parameter if there exist such a value, or that contains nothing there is no such a default value.

... stands for any other useful or future parameter. Currently you may use NAME to specify the parameter label in the input widgets

miniGUIdefaultEntry is the default input widget, at the moment a simple tkentry.

miniGUIentry(x) makes the tkentry related to the parameter to contain x. This widget is included as an example of the way widget can be added.

miniGUIscale(from,to,by) uses tkscale to show a slider that allows to input numerical values in the range from, to with an increment of by.

miniGUImenusel(xx) uses ttkcombobox (needs Tcl version 8.5 or later) to show a menu with entries xx, a character or numerical vector.

These functions and their implementation show how new input widget can be added in a simple way.

Value

All these functions returns an object miniGUIwidget, that is a list with at least the entry widget that should be a function and any other detail.

The function widget builds an entry widget using tcltk functions and should return it. This function should be defined having three parameters: FRAME, STORE, VAR. In short, the first one is used by the internal code to provide a tcltk parent frame, the second to provide a place where to save the value of the parameter and the third one is used to save the parameter name.

The implementation details may change in the future.

Author(s)

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

See Also

miniGUI, makeWidgetCmd, tcltk.

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
  require(tcltk)
  ##
  ##  simple example 
  ##
  #   ...define a function
  h <- function(a=miniGUImenusel(c(1,5,10)),
		b=miniGUIscale(from=5,to=10,by=2),
		c=miniGUIentry(4),
		d=miniGUImenusel(c("T","F")),
                e
		)
  {
    cat("--h--");paste("h(a,b,c)=",d*(a+b+c))
  }
  ## building it
  hmm <- makeWidgetCmd("Hay !!",h)
  hmm()
  ##
  ##  another example
  ##
  ## create some data(in the global environment)
  n <- 100
  d <- data.frame(x=runif(n))
  d$z <- 0.5 * rnorm(n)
  d$y <- 2 * d$x + d$z
  ## def mylm method
  mylm <- lm
  formals(mylm)$method <- quote( miniGUImenusel(c('"qr"','"model.frame"')) )
  formals(mylm)$x <- quote( miniGUImenusel(c("FALSE","TRUE")) )
  ## add this stuff
  miniGUI(evalPlugin,opFuns=list(mylm=mylm,lm=lm)) 

miniGUI documentation built on May 1, 2019, 10:18 p.m.