Stop text view to scroll on pageup/down



I've assigned a global meaning to the PageUp/Down keys in a application and
I catch them with a key snooper. The keys are catched and the action
performed, but if the window contains a textview also the textview contents
are scrolled, so I tried to "catch" the keys in the textview, and then in
the scrolledwindow but without results:

    g_signal_connect(sw, "key-press-event", (GCallback)eat_pageupdown,
NULL);
    g_signal_connect(tv, "key-press-event", (GCallback)eat_pageupdown,
NULL);
    g_signal_connect(sw, "key-release-event", (GCallback)eat_pageupdown,
NULL);
    g_signal_connect(tv, "key-release-event", (GCallback)eat_pageupdown,
NULL);

Where "eat_pageupdown" is:

gboolean eat_pageupdown(GtkWidget  *widget, GdkEventKey *event, gpointer
user_data)
{
    return (event->keyval == GDK_Page_Up || event->keyval == GDK_Page_Down);
}

Obviously this doesn't work... So here is my question: what is the correct
way to override the standard paging keys for a TextView?

-- 
Bye,
 Gabry



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