Re: menu accelerators



On Fri, 1 Dec 2000, Guy Harris wrote:

> On Fri, Dec 01, 2000 at 10:50:44PM -0600, Lars Clausen wrote:
>> On Fri, 01 Dec 2000, Paul Barton-Davis wrote:
>> > as far as i can tell, this is not a built-in feature of GTK, but
>> > something done by the GIMP. the menu accelerators in my Gtk-- apps do
>> > not appear to be dynamic.
>> 
>> Well, Dia does it as well, as does Eye of Gnome, Gnome Control Center,
>> Gnotravex, Glade,...
> 
> ...Ethereal...
> 
> As far as *I* can tell, it's a built-in feature of GTK+; Ethereal's menu
> bar is extraordinarily boring and vanilla - we didn't do anything to
> enable it.

Good to know -- I hear it used to be a Mac add-on feature, but it's
wonderful to have it builtin.

>> haven't found any that doesn't do it.  Maybe Gtk--
>> disables it?  I'm very happy to have this an inherent feature of Gtk.
> 
> The mouse-pointer aspect of the feature hasn't ever bothered me.
> 
> However, if you do Alt+{character} while a menu item is activated, *even
> if the mouse pointer isn't over the menu item*, it makes Alt+{character}
> the accelerator for that menu item; this means that if you're driving
> the menu via the keyboard, you'd better take your finger off the Alt key
> before striking any menu accelerator key, or, instead of activating the
> menu item whose "mnemonic" (to use the Windows term - i.e., the
> underlined letter in the menu item, if any) is the character in
> question, it assigns a new mnemonic to the currently active menu item,
> which is probably the default item.

More irritatingly, if you press the underlined letter (without Alt), it
will activate that item rather than set the letter.  I've never been one to
make use of the underscore letters, and now they're in the way of sensible
shortcuts.  Is there a way to turn them off completely?

> I don't think that's ever gotten in my way; however, it *might* surprise
> somebody used to Windows (where I think the Alt key can be down or not
> when the menu-item mnemonic is pressed) or, I think, Motif (which, if I
> remember correctly, requires that you *keep* the Alt key down).

Very possible.  I feel (but not strongly) that the underline markup should
go away in favor of right-hand changeable shortcuts.  The underline markup
is an ugly mix of name and functionality.

>> I'm not sure if they're automatically saved, though.
> 
> They're not, at least not in Ethereal; i.e., an application would
> presumably have to save them itself somehow.

Come to think of it, I added support for that to Dia.  The function is
gtk_item_factory_dump_rc:

  /* Save menu accelerators */
  filename = dia_config_filename("menus" G_DIR_SEPARATOR_S "toolbox");
  if (filename!=NULL) {
    GtkPatternSpec pattern;

    gtk_pattern_spec_init(&pattern, "*<Toolbox>*");

    gtk_item_factory_dump_rc (filename, &pattern, TRUE);
    g_free (filename);
    gtk_pattern_spec_free_segs(&pattern);
  }

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause) | Hårdgrim of Numenor
"I do not agree with a word that you say, but I    | Retainer of Sir Kegg
will defend to the death your right to say it."    |   of Westfield
    --Evelyn Beatrice Hall paraphrasing Voltaire   | Chaos Berserker of Khorne




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