Re: Events and derived objects



Tristan Van Berkom wrote:

Are you sure that the text view's handler gets called at all ?
in other words; are you sure you're returninig FALSE from
your "Internal key handler" ?

Yes, and as I matter of fact I removed this to test, and it did'nt
change a thing.

What happens is that if I connect to the derived widget's
"key-press-event", using something like this:

MyWidget *derived = my_widget_net(...);
g_signal_connect(G_OBJECT(derived), "key-press-event",
G_CALLBACK(keypress_cb), NULL);

Then the callback function only gets called after the internal handler
for the text view that happens to be included inside MyWidget (which is
derived from HBox). So I can catch, for example, function keys (since
they have no action for a TextView), but not an arrow key (because these
are used for cursor movement). And I need exactly this - to add some
extra functionality to arrow keys.

However, if I connect the signal directly to the TextView inside
MyWidget (with something like derived->text_view), then it works as I
want: keypress_cb is called before, I can capture and override some keys
and return FALSE for all others, and then the TextView's handler deals
with them doing what is necessary.

By the way, the same happens with a GtkEntry, it is not a problem with
the TextView.

Perhaps I need to declare something for MyWidget class to properly
handle such events?

-- 
Push where it gives and scratch where it itches.

Eduardo M KALINOWSKI
ekalin bol com br
http://move.to/hpkb




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