----------------------- *** Disclaimer *** -----------------------
This e-mail and its contents are subject to the SA Reserve Bank's
Disclaimer and Confidentiality Clause, which can be viewed at:
http://www.reservebank.co.za/disclaimer
Should you be unable to access the link provided, please send a
blank e-mail to disclai...@resbank.co.za 
----------------------- *** Disclaimer *** -----------------------


Dear list,

Using gWidgets, I'm trying to construct a simple GUI where a user can select a 
variable (in a data.frame) from a drop-down list and then set a limit using a 
spin-button. Additionally, I want the default to, from and value arguments of 
the spin-button to equal the min, max and mean of the selected variable, 
respectively.

How do I get the spin-button to update when the user selects a different 
variable from the drop-down list?

Here is my amateurish attempt at doing this, but the results are not 
satisfactory, since it simple keeps adding new spin buttons and it doesn't 
start up with a spin button.

.simple <- function(x){
   addSpin <- function(h, ...){
      data <- eval(parse(text = paste("x$", svalue(varis), sep = "")))
      spin <- gspinbutton(from = min(data), to = max(data), value = mean(data))
      add(mainG, spin)
      }
   win <- gwindow("Example")
   mainG <- ggroup(horizontal = FALSE, container = win)
   varis <- gdroplist(names(x), container = mainG)
   addhandlerchanged(varis, handler = addSpin)
   }

Any help whatsoever would be most appreciated.

Kind regards,





Stefan Janse van Rensburg
Macroprudential Division
Financial Stability Department
SARB
Tel : 012-313 4687
Fax : 012 313 4772

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-GUI mailing list
R-SIG-GUI@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-gui

Reply via email to