Skip to main content



      Home
Home » Eclipse Projects » Eclipse 4 » How to use the attribute mnemonic for menus and menu items?
How to use the attribute mnemonic for menus and menu items? [message #1690456] Fri, 27 March 2015 08:02 Go to next message
Eclipse UserFriend
Hi

I noticed today that there is an attribute "mnemonics" for menus and menu items. I thought I would give it a try and removed any & characters from the "label" and put the letter I wanted to use in "mnemonics".

The effect was that the menu and menu items all displayed the first letter of its label as the mnemonic. (Which is a great default btw, if no mnemonic is specified!). The value of the attribute "mnemonics" was ignored.

<mainMenu xmi:id="_kzslkGdLEeCwy-Dv6QH0PA" elementId="de.emsw.e4.test.mnemonic.menu.main">
  <children xsi:type="menu:Menu" xmi:id="_l-QUMGdLEeCwy-Dv6QH0PA" elementId="de.emsw.e4.test.mnemonic.menu.file" label="File" mnemonics="i">
	<children xsi:type="menu:HandledMenuItem" xmi:id="_UKiVENLVEeSTQcfhQVYxwA" elementId="de.emsw.e4.test.mnemonic.handledmenuitem.message" label="Message" mnemonics="e" command="_8iY0gNLTEeSTQcfhQVYxwA"/>
	<children xsi:type="menu:HandledMenuItem" xmi:id="_6lMsANO4EeSTQcfhQVYxwA" elementId="de.emsw.e4.test.mnemonic.handledmenuitem.dialog" label="Dialog" command="_1lLHsNO4EeSTQcfhQVYxwA"/>
	<children xsi:type="menu:MenuSeparator" xmi:id="_U_QWkNLVEeSTQcfhQVYxwA" elementId="de.emsw.e4.test.mnemonic.menuseparator.0"/>
	<children xsi:type="menu:HandledMenuItem" xmi:id="_vDrnoGdLEeCwy-Dv6QH0PA" elementId="de.emsw.e4.test.mnemonic.handledmenuitem.exit" label="Exit" mnemonics="x" command="_nFWfIGdLEeCwy-Dv6QH0PA"/>
  </children>
</mainMenu>

Am I using this wrong? Or is this a bug?

Why is the attribute called "mnemonics" in plural? Is there a need for multiple mnemonics? Our accessibility guide lines state that there has to be a mnemonic on every menu item, and that the same mnemonic should be used for the same labels. One mnemonic is enough though.

Cheers
Christoph
Re: How to use the attribute mnemonic for menus and menu items? [message #1690463 is a reply to message #1690456] Fri, 27 March 2015 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Same question are you talking about SWT or JavaFX rendering?

Tom

On 27.03.15 13:02, Christoph Keimel wrote:
> Hi
>
> I noticed today that there is an attribute "mnemonics" for menus and
> menu items. I thought I would give it a try and removed any & characters
> from the "label" and put the letter I wanted to use in "mnemonics".
>
> The effect was that the menu and menu items all displayed the first
> letter of its label as the mnemonic. (Which is a great default btw, if
> no mnemonic is specified!). The value of the attribute "mnemonics" was
> ignored.
> <mainMenu xmi:id="_kzslkGdLEeCwy-Dv6QH0PA"
> elementId="de.emsw.e4.test.mnemonic.menu.main">
> <children xsi:type="menu:Menu" xmi:id="_l-QUMGdLEeCwy-Dv6QH0PA"
> elementId="de.emsw.e4.test.mnemonic.menu.file" label="File" mnemonics="i">
> <children xsi:type="menu:HandledMenuItem"
> xmi:id="_UKiVENLVEeSTQcfhQVYxwA"
> elementId="de.emsw.e4.test.mnemonic.handledmenuitem.message"
> label="Message" mnemonics="e" command="_8iY0gNLTEeSTQcfhQVYxwA"/>
> <children xsi:type="menu:HandledMenuItem"
> xmi:id="_6lMsANO4EeSTQcfhQVYxwA"
> elementId="de.emsw.e4.test.mnemonic.handledmenuitem.dialog"
> label="Dialog" command="_1lLHsNO4EeSTQcfhQVYxwA"/>
> <children xsi:type="menu:MenuSeparator"
> xmi:id="_U_QWkNLVEeSTQcfhQVYxwA"
> elementId="de.emsw.e4.test.mnemonic.menuseparator.0"/>
> <children xsi:type="menu:HandledMenuItem"
> xmi:id="_vDrnoGdLEeCwy-Dv6QH0PA"
> elementId="de.emsw.e4.test.mnemonic.handledmenuitem.exit" label="Exit"
> mnemonics="x" command="_nFWfIGdLEeCwy-Dv6QH0PA"/>
> </children>
> </mainMenu>
> Am I using this wrong? Or is this a bug?
>
> Why is the attribute called "mnemonics" in plural? Is there a need for
> multiple mnemonics? Our accessibility guide lines state that there has
> to be a mnemonic on every menu item, and that the same mnemonic should
> be used for the same labels. One mnemonic is enough though.
>
> Cheers
> Christoph
Re: How to use the attribute mnemonic for menus and menu items? [message #1690469 is a reply to message #1690463] Fri, 27 March 2015 09:13 Go to previous messageGo to next message
Eclipse UserFriend
It's a multi-layer question Smile

Generic: How is it supposed to work?
e4: Does the SWT renderer support this?
efxclipse: Does the JavaFX renderer support this?
Re: How to use the attribute mnemonic for menus and menu items? [message #1690476 is a reply to message #1690469] Fri, 27 March 2015 10:12 Go to previous messageGo to next message
Eclipse UserFriend
On 27.03.15 14:13, Christoph Keimel wrote:
> It's a multi-layer question :)
>
> Generic: How is it supposed to work?
> e4: Does the SWT renderer support this?
> efxclipse: Does the JavaFX renderer support this?

Not at the moment but we could do it by modifying the text passed to the
menu-item.

Tom
Re: How to use the attribute mnemonic for menus and menu items? [message #1690485 is a reply to message #1690476] Fri, 27 March 2015 11:02 Go to previous message
Eclipse UserFriend
> Not at the moment but we could do it by modifying the text passed to the
> menu-item.

Yeah. I had a deeper look at the SWT render code and it seems as though my assumptions are correct. The mnemonic can be any substring (case sensitive) of the label. If the attribute is present and is a substring of the label a & character is inserted into the label at the appropriate position. (see HandledContributionItem:449)


Previous Topic:Associate each tab of a multipage editor with a different file.
Next Topic:Ampersands showing on menu labels, instead of mnemonics
Goto Forum:
  


Current Time: Thu Jul 17 12:22:21 EDT 2025

Powered by FUDForum. Page generated in 0.03999 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top