thehellmaker
thehellmaker

Reputation: 168

Change the events for different parts of the same widget

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?

Upvotes: 0

Views: 91

Answers (1)

unwind
unwind

Reputation: 399833

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.

Upvotes: 1

Related Questions