Learn R Programming

RPMG (version 2.2-2)

RPMG-package: 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.

Arguments

Details

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

See Also

rowBUTTONS, whichbutt

Examples

Run this code
# NOT RUN {
###  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
# }
# NOT RUN {


# }

Run the code above in your browser using DataLab