Re: Re[2]: Better accelerator keys support



El jue, 03-07-2003 a las 05:13, Martin Stubenschrott escribió:

> Well, if the widget has the focus, then the space bar is natural.
> Sorry, I think I didn't specify this clearly enough. I mean, when the
> focus is on one button I can activate any other button with the
> Alt-key support. Space bar only works if the widget has the focus, and
> switching to one control out of dozens can be very time consuming.
> 
> What I meant, was that e.g. if the focus is on the button "&Sample
> button" I could activate the button "&Another button" by just pressing
> 'A' instead of Alt-'A'. (On american keyboard this is not so annoying
> since you have a second Alt-button right to the space bar, but on a
> german keyboard layout, I don't have this second Alt button, which
> means that I often need both hands to activate a shortcut).

The American keyboard has the same issue because the right-alt-key does
not generate the same modifier as the left. 

> 
> This really made me wondering when I tried to switch to Linux since I
> am a keyboard guy, and I always thougth linux was much better than
> windows in this area, but actually I found out that Windows keyboard
> accessibility support is even better than Linux's.

It's not windows, but the window's application you are talking about,
just as linux is far removed from a gtk application. 

To get the thing you want bind the keypressed signal to all the buttons
where you want the behaviour described and write a small callback that
will generate a buttonclick signal depending on which letter was typed.
This here is an example where a keypress signal will do the effect of
pressing a button (without an accelerator being defined):

static gboolean treeview_key(GtkWidget *w,
		GdkEventKey *event,gpointer data){
	switch (event->keyval){
		case GDK_Print:
			tb_print((GtkButton *)w,NULL);
			return TRUE;
		case GDK_Execute:
			on_run_activate((GtkMenuItem *)w, NULL);
			return TRUE;
}

Look at <gdk/gdkkeysyms.h>

Edscott


> 




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