更改同一小部件不同部分的事件
我在 gtk.TextView 小部件中创建了边距。现在我想确保鼠标单击的默认事件处理程序(将文本光标移动到单击的位置)仅在单击边距右侧时才起作用。
这可能吗?
I have created a margin in a gtk.TextView widget. Now I want to make sure that the default event handler for mouse click, which is moving the text cursor to the clicked position, works only when clicked to the right of the margin.
Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试连接到 button-press-event< /a> 但在小部件自己的连接之前执行此操作。如果您在视图执行连接后进行连接,则这将是默认设置(默认情况下,GObject 信号处理程序按照连接的相反顺序进行处理)。然后根据需要返回
TRUE
(停止事件)或FALSE
来确定是否应允许事件通过。Try connecting to the button-press-event but doing it before the widget's own connection. If you connect after the view does it, this will be the default (GObject signal handlers are handled in reverse order of connection by default). Then determine if the event should be let through or not, by returning
TRUE
(to stop the event) orFALSE
as required.