Re: Events and derived objects



Tristan Van Berkom wrote:

a key-press-event of the TextView inside the derived widget's
implementation, but I have'nt discovered how to propagate keys unhandled
by the TextView itself or by my special handler to the user.

I've achieved capturing some specials keys, but letting everything
else work as normally in the TextView by connecting a handler to

If the user wants to treat events that are not handled by the
widget's event handler, they'll have to use g_signal_connect_after
(or the appropriate flag), otherwise the handler will be called
before the default widget's handler.

So the normal chain would be:
   my_ojbect_key_press (connected to textview delagate's
                        key-press-event)
   key_press_cb        (connected by the user using g_signal_connect)
   textview_key_press  (base class handler)
   after_key_press_cb  (connected by the user using
                        g_signal_connect_after)

And ofcourse, the first handler to return TRUE effectively
stops the emission. 

This worked indeed for the situation described, but then I realised that
what I need is not what I had described. <sigh>

The user-connected signal handler must happen before the default
TextView handler, so that it can have special actions for keys that the
TextView would handle. So the order must be like this:

    - Internal key handler: connected in MyWidget's initialization to
the TextView itself.
    - User signal handler: connected to MyWidget's "key-press-event" by
user of this widget.
    - If the key was not handled by one of the above, then let the
default key handler take it and do the normal action.

What is happening is that the user signal handler is being run only
after the default handler, even if g_signal_connect (not after) is used,
but it should happen before.

-- 
She's so tough she won't take 'yes' for an answer.

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]