Re: Arrow keys as accellerators?



On Mon, 2006-04-10 at 17:59 -0700, Ian Puleston wrote:
> Hi,
> 
> I've trying to install accelerator keys for a scrolled window to get the
> page-up, page-down, up-arrow and down-arrow keys to act as short-cuts for
> the vertical scroll bar. I install them as follows:
> 
>     accelGrp = gtk_accel_group_new();
>     gtk_window_add_accel_group(GTK_WINDOW(mainWin), accelGrp);
>     closure = g_cclosure_new(G_CALLBACK(accelKeyHandler), "up", NULL);
>     gtk_accel_group_connect(accelGrp, GDK_uparrow, 0, 0, closure);
>     closure = g_cclosure_new(G_CALLBACK(accelKeyHandler), "page-up", NULL);
>     gtk_accel_group_connect(accelGrp, GDK_Page_Up, 0, 0, closure);
>       ....
> 
> This works fine for the page-up and page-down keys, but the up-arrow and
> down-arrow keys do not get intercepted and passed to the key handler
> function. I'm guessing that this is because they are used for movement
> around the buttons on the window. So:
> 
> 1. Is there some way to unbind the up/down arrow keys from the button
> navigation so that they can be used as accelerators?

no, this is disallowed in the source code. explicitly. if this isn't
objectionable enough, KP_{Up,Right,Left,Down} are also prevented from
being used as accelerators.






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