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?
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) or FALSE
as required.
精彩评论