简体   繁体   中英

addHandlerFocus 'event_decorator' not found

My package is currently developed using gWidgets2RGtk2. I am trying to make it compatible with gWidgets2tcltk. However, I get this error which I can't figure out:

Error in connect_to_toolkit_signal(signal, decorator = decorator, emitter = emitter,  : 
object 'event_decorator' not found

A small example which is working using gWidgets2RGtk2 but gives the error using gWidgets2tcltk:

require(gWidgets2)
gui_example <- function(){

  # Main window.
  w <- gwindow(title=paste("GUI test"), visible = FALSE, name=title)

  # Main group.
  gv <- ggroup(horizontal=FALSE, use.scrollwindow=FALSE, container = w, expand=TRUE) 

  # Notebook.
  nb <- gnotebook(closebuttons = FALSE, dontCloseThese = NULL, container = gv)


  # Define groups.
  tab_1 <- ggroup(container = nb, label="Tab1")
  tab_2 <- ggroup(container = nb, label="Tab2")
  tab_3 <- ggroup(container = nb, label="Tab3")

  gtext(text="Tab1", expand=TRUE, container = tab_1) 
  gtext(text="Tab2", expand=TRUE, container = tab_2) 
  gtext(text="Tab3", expand=TRUE, container = tab_3) 


  addHandlerChanged(nb, handler = function (h, ...) {

    print("CHANGED...")
    print(if(is.null(h$page.no)) svalue(h$obj) else h$page.no)

    # Get active tab.
    tab <- if(is.null(h$page.no)) svalue(h$obj) else h$page.no
    tabName <- names(nb)[tab]

    print(paste("Active tab:", tab))
    print(paste("Active tab name:", tabName))

  })

  addHandlerFocus(w, handler = function (h, ...) {

    print("FOCUS...")

    # Get active tab.
    tab <- svalue(nb)
    tabName <- names(nb)[tab]

    print(paste("Active tab:", tab))
    print(paste("Active tab name:", tabName))

  })

  # Show GUI and first tab.
  svalue(nb) <- 1
  visible(w) <- TRUE
  focus(w)
  message("Example loaded!")

}

How do I avoid this error when using the gWidgets2tcltk package, and maintain compatibility with gWidgets2RGtk2?

Here is my system information:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
gWidgets2_1.0-7
gWidgets2RGtk2_1.0-7
RGtk2_2.20.35
gWidgets2tcltk_1.0-5

错误已在GitHub上修复-参见@jverzani的评论

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM