Really Poor Man's GUI: sets up buttons for a graphical user interface in R

Description

Package consists of two functions for setting up a\ GUI using only R-code.

Details

Package: RPMG
Type: Package
Version: 2.1-2
Date: 2008-08-15
License: GPL

Author(s)

Jonathan M. Lees <jonathan.lees@unc.edu>

See Also

rowBUTTONS, whichbutt

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
34
35
###  get sample image data set.
data(volcano)
#####   set sample interval unit
attr(volcano, 'dx') =10
attr(volcano, 'dy') =10
###  create the list of labels
###  Actions for these buttons are described in the calling program XSECDEM
mybutts = c("DONE", "REFRESH", "rainbow", "topo", "terrain", "CONT", "XSEC","PS" )
XSECDEM(volcano, mybutts)
############################################# 
#############################################  CODE STUB
## Not run: ###   Example code chunk:
###  general set up of RPGM usage:
######  make a plot
#######  set buttons
buttons = rowBUTTONS(c("BUT1","BUT2") , col=c(1,1), pch=c(1,1))
#######  after plotting, locate in plot....
zloc = locator()
Nclick = length(zloc$x)
#############  the last click on the screen before stopping (middle
#############        mouse click) is used to set the action
K =  whichbutt(zloc , buttons)
while(TRUE)
      {
	if(K[Nclick] == match("BUT1", labs, nomatch = NOLAB))
          {
            ###  do what ever button 1 is supposed to do
          }
	if(K[Nclick] == match("BUT2", labs, nomatch = NOLAB))
          {
            ###  do what ever button 2 is supposed to do
          }
	}  ## end while loop

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.