Re: Events and derived objects

Eduardo M KALINOWSKI wrote:
However, I find that solution not nice. The derived object structure
should be considered opaque, for example. I would like to connect the
signal to the derived object iself, not to widgets inside it:

g_signal_connect(G_OBJECT(derived_object), ...)

and have the same behaviour as above. Currently, doing it like this
calls the key handler after the default GtkTextView one, and this means
I can only catch keys not handled by the GtkTextView.

    What I'm wondering; is how it turns out to be called at all !

Wait a second ! is it because the actual widget is passing an
unhandled key-press-event to its parent widget ? HA!

What you need to do is provide an interface for this in your
derived object, just because GtkBox also has a "key-press-event"
doesn't mean its the *same* key-press-event as the text-view's.

You can use your derived objects key-press-event handler as
a proxy, create a signal with g_signal_new() and filter keys
out by emitting that signal in your key-press-event handler.

That would be a clean implementation.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]