Daichi Kawahata wrote:
> Paco Arjonilla <[EMAIL PROTECTED]> wrote:

> > what about a little funciton that gets a list of menu items and
> > assigns automatically the best accelerator keys,
 
> It sounds good, possibly that function should be included in the
> glade itself though. I agree if such a function (or a little perl
> script) exists, but if you say "the best" it's something hard in
> my opinion...
 
> > independently of the language used? I would do it myself,

Presuming that it's possible to walk the complete GUI widget by
widget and changing the accelerator assignments on the fly, I could
imagine the following:

Instead of using an underscore directly, you'd label the widget
with "_F|File" instead of "File". The 'F' does just indicate a
preference. At run-time all such strings found in labels or
titles first have the prefix stripped. Next the accelerator
assignment is checked. If the key is already used, the next best
character found in the string that is not yet used is assigned.
Of course, there might still be clashes.
If the chosen character doesn't appear in the string itself
(the check should probably be case-insensitive), it's appended with
parentheses to the string e.g., "Bogus (X)".
Translators can use different preferences for the key. It might
also be useful to provide multiple preferences e.g., to work around
unfortunate clashes e.g., "_FL|File" and "_FND|Find". If an
underscore is considered to cryptic something like
"accelerator:FL|File" could be used instead.

Any volunteers?

-- 
Christian

Do NOT encrypt mail ever - under no circumstances whatsoever.

Attachment: pgp07JWD58wIN.pgp
Description: PGP signature

Reply via email to