0

I'm struggling to update the table data in the following code for GUI. It works to add each new request to the previous, so that it doesn't fit the screen, while I need to replace old request with the new one. Thanks! A.

require ( gWidgets )
options ( guiToolkit="RGtk2" )
window <- gwindow ( "Pilot>>" , visible = FALSE, horizontal = FALSE )
paned <- gpanedgroup ( cont = window )
group <- ggroup ( cont = paned, horizontal = FALSE  )
glabel ( "FPC:" , cont = group )
entry <- gedit ( "" , cont = group )
entry [ ] <- actfpc$CURFPC ##list of codes for auto-filling
search_button <- gbutton ( "Go!" , cont = group )
addSpring ( group )
frame <- gframe ( "Supply:" , cont = paned , horizontal = FALSE,use.scrollwindow=TRUE )
addHandlerChanged ( search_button , handler = function ( h , ... ) {
    ##Data subset for entered value
    a<-skulist[skulist$FPC==svalue(entry),]
    a<-a[c("X_id","FPC","STATUS","COMMENT","DCTR","DCSTOCK")]
    tbl <- gtable ( a , cont = frame, expand=TRUE )
        } )
size ( frame) <- c ( 950 , 250)
visible ( window ) <- TRUE
  • Use `[<-` to update the data displayed by `gtable` (as you would do with a data frame). You might have issues, as columns need to remain the same type. If you wish to restructure the data displayed, you can remove the old widget with `delete` and replace a new one. – jverzani Jun 23 '14 at 01:36
  • @jverzani want to expand that into an answer? – bright-star Sep 26 '14 at 00:06
  • If `tbl <- gtable(mtcars, cont=...)` say, then you should be able to modify a single value via `tbl[1,1] <- 12`, or replace the entire data set, with something like `tbl[] <- mtcars[1:2, 1:4]`. – jverzani Sep 26 '14 at 00:37

0 Answers0