I am trying to create a interface where the user can key in a number for the script to run. However, I am unable to retrieve the value keyed into gedit. Can anyone help me? Here's what I have done:
require(gWidgets2RGtk2) #Load package
w=gbasicdialog("key number")
a<-gedit("1",cont=w,handler=function(h,...){number<-svalue(a)})
visible(w)=TRUE
Here I create , 2 gedit and update the value of one with the other value using a button:
w <- gwindow("test")
g <- ggroup(cont=w, horizontal=FALSE)
x <- gedit("20",cont=g)
gbutton("changevalue",cont=g,handler=function(h,...) {
svalue(e) <- svalue(x)
})
e <- gedit("", cont=g)
What I have done here is the same as suggested by jverzani
require(gWidgets2RGtk2) #Load package
w = gbasicdialog("key number")
a <- gedit("1",cont=w)
addHandlerKeystroke(a, handler=function(h,..) {
number <- svalue(a)
print(number)
})
visible(w)=TRUE