1

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
Wet Feet
  • 4,435
  • 10
  • 28
  • 41

2 Answers2

0

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)

enter image description here

agstudy
  • 119,832
  • 17
  • 199
  • 261
0

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