简体   繁体   English

找不到addHandlerFocus'event_decorator'

[英]addHandlerFocus 'event_decorator' not found

My package is currently developed using gWidgets2RGtk2. 我的软件包当前是使用gWidgets2RGtk2开发的。 I am trying to make it compatible with gWidgets2tcltk. 我正在尝试使其与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: 一个使用gWidgets2RGtk2的小例子,但是使用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? 使用gWidgets2tcltk软件包时如何避免此错误,并保持与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的评论

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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