Re: Override some behavior of gtk_sheet_key_press



On Fri, 12 Oct 2001, Paul Davis wrote:

> >I've added my handler like so:
> >
> >gtk_signal_connect(GTK_OBJECT(sheet), "key_press_event", (GtkSignalFunc) key_p
> >ress_event_cb, NULL);
> >
> >But apparently gtk_sheet_key_press() is doing its thing before my handler.  Is
> >there a way to have my handler called first and then pass on control for
> >certain keys to the built-in handler?
>
> within your handler:
>
>    gtk_signal_emit_stop_by_name (GTK_OBJECT(sheet), "key_press_event");
>
> for those keys that you don't want handled by the default handler. if
> the archive was up, i'd point you to the half-dozen entries about this
> that would be there. alternatively, i'd write a new FAQ entry. but
> since this changes fairly significantly in GTK 1.3/2.0 so that this
> kind of nonsense is no longer necessary, it doesn't seem worth it.
>

You can also do:
 GTK_WIDGET_CLASS(GTK_OBJECT(sheet)->klass)->key_press_event =
my_key_press_handler;

This is more "low level" hacking, and it will COMPLETELY override the
sheet handler, i.e., you'll have to reimplement all the code to handle the
different keys.

I've never tried, but I guess it should work.
Saludos,
<ADRIAN>





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