Re: [gtk-list] Re: Keyboard accelerators



On 15 Nov 1997, Tom Tromey wrote:

> Maciej> In many GUI systems, the first letters (or occasionally
> Maciej> another in case of conflict) of menu items, pushbuttons, and
> Maciej> the labels of all dialog controls are underlined, and you can
> Maciej> simply hit some modifier key plus the letter (Meta would be a
> Maciej> good choice for X) to push the button, activate the menu, or
> Maciej> switch to the control.
> 
> Actually, Motif GUIs have two different key binding notions (I don't
> know if Windows is the same, but I assume so because it shows both the
> GUI elements below):
> 
> 1. The underlined letter on a menu item is used when doing keyboard
> menu traversal.  With Motif you can start keyboard menu traversal with
> F10.
> 
> 2. The accelerator is displayed to the right of the menu item's text,
> and shows the key sequence that can be used anywhere in the window to
> get that functionality.
> 
> 
> That's for menus.  I've seen underlined letters on buttons in Windows,
> but I don't know what they do.  Never tried fooling with it.

In Windows it works more or less like Maciej states: when the button or
menu is in a local context (i.e., the containing window has focus) the Alt
key plus the underlined letter serves to switch tab focus to that control,
and activate it, dropping down a menu, toggling a button. That the
underlined letter works during menu traversal is secondary, and probably
not often used.

> Maciej> I can't seem to find similar functionality in gtk
> 
> I guess you can make an "underlined label" widget and then just use it
> instead of a label.

Since its useful to have many controls respond especially in this manner
(especially menus, buttons, checkboxes, and radio buttons) and to be able
to switch tab focus, I think it should be a technique usable by all
controls that have a simple label. 

> Note that if you're doing this, it would be nice if you could specify
> the underline as part of the label string.  That way it is easier to
> internationalize: (eg) you can just pass in the text "_Open" and not
> have to run "_Open" through gettext and extract the underline position
> by hand (or worse, find some nasty way to put the underline position
> into the gettext database).
>
> This has been an ongoing hassle when trying to internationalize
> Tk-based applications; it would be cool if GTk made it easy.

Agreed. Windows actually uses '&' for this, but '_' might work just as
well, perhaps better (since a '_' is less likely to be desired then a
'&'). 

-- 
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)





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