本文介绍了如何绑定ESC键以关闭gWidgets中的`gwindow()`?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑:
require(gWidgets2)
w <- gwindow("notebook example", visible=T)
nb <- gnotebook(container=w)
gbutton("Page one", label="tab 1", container=nb) ## note label argument
gbutton("Page two", label="tab 2", container=nb)
如何绑定给定键(例如ESC
)以关闭gWidgets中的gwindow()
,即执行dispose(w)
?换句话说,如何在gWidget中分配键绑定?
How can I bind a given key (say, ESC
) to close the gwindow()
in gWidgets, that is to execute dispose(w)
? In other words, how do you assign keybindings in gWidgets?
推荐答案
对于RGtk2(可能还有其他),addHandlerKeystroke
方法可用于捕获击键.您必须深入研究h
对象以捕获ESC
键.没有任何可移植的代码,但是Gtk文档应该能够提供帮助.
With RGtk2 (and possibly others) the addHandlerKeystroke
method can be used to catch keystrokes. You have to dig into the h
object to capture the ESC
key. There isn't any portable code for that, but the Gtk docs should be able to help.
这篇关于如何绑定ESC键以关闭gWidgets中的`gwindow()`?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!