FYI, and just in case anyone else needs to do this too, I figured out a way to get the up/down keys working as accelerators for scrolling my scrolled window. The up/down keys that GTK won't let me use are GDK_Up/GDK_Down, so instead I registered the accelerators as GDK_uparrow/GDK_downarrow: 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), "down", NULL); gtk_accel_group_connect(accelGrp, GDK_downarrow, 0, 0, closure); Then I installed an event handler for the "key_press_event" on the main window and had this check for GDK_Up/GDK_Down and activate the above accelerators like this (note that I only intercept these keys when my scrolled window is showing): gboolean winKeyHandler(GtkWidget *topWin, GdkEvent *event, gpointer data) { gboolean ret = FALSE; if (viewWinShowingNow() && event->type == GDK_KEY_PRESS) { GdkEventKey *keyEvnt = (GdkEventKey*)event; switch (keyEvnt->keyval) { case GDK_Up: gtk_accel_groups_activate(G_OBJECT(topWin), GDK_uparrow, 0); ret = TRUE; break; case GDK_Down: gtk_accel_groups_activate(G_OBJECT(topWin), GDK_downarrow, 0); ret = TRUE; break; } } return ret; } > -----Original Message----- > From: Paul Davis [mailto:paul@xxxxxxxxxxxxxxxxxxxxx] > Sent: Monday, April 10, 2006 6:53 PM > To: Ian Puleston > Cc: gtk-list@xxxxxxxxx > Subject: 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. > _______________________________________________ gtk-list@xxxxxxxxx http://mail.gnome.org/mailman/listinfo/gtk-list