如何捕获 Gtk.TreeView 中的点击?
我正在尝试捕获 TreeView 的空白区域中的双击事件以创建新节点。 不幸的是标准方法不起作用。 我尝试将 ButtonPressEvent 附加到 TreeView 和托管电视的 ScrolledWindow 。 我的函数没有收到任何回调。
我该如何解决这个问题?
I'm trying to catch a double-click event in a TreeView's empty area to create a new node. Unfortunately standard way doesn't work. I've tried attaching ButtonPressEvent to both TreeView and the ScrolledWindow in which T.V. is hosted. I don't get any callbacks to my function.
How can I solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要在处理程序上使用 GLib.ConnectBeforeAttribute 来处理 TreeView.ButtonPressEvent,否则小部件将在内部处理该事件,并且不会调用您的处理程序。
例子:
You'll need to use the GLib.ConnectBeforeAttribute on your handler to handle TreeView.ButtonPressEvent, otherwise the widget will handle the event internally and your handler won't be called.
example:
http://old.nabble.com/CellRenderer-editable-on -双击-td24975510.html
http://old.nabble.com/CellRenderer-editable-on-double-click-td24975510.html
我认为 Treeview 有自己的窗口。
获取窗口句柄,然后SendMessage(treeview->Getsafehwnd() , tvi_root, tvichildren)
以上发送消息仅供您理解。
I think the Treeview has a window of its own.
Get the window handle, and then SendMessage(treeview->Getsafehwnd() , tvi_root, tvichildren)
The above send message is for your understanding only .