tags:

views:

42

answers:

1

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?

+1  A: 

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.

unwind
This is the way. A minor detail: the cursor movement is handled by the _class closure_ (once called _default handler_) and "button-press-event" is `G_SIGNAL_RUN_LAST`, so it does not care where you connect your callback: it will always be invoked before the class closure if the after flag is not set.
ntd
could you please explain a little in detail please ???
Akash A