Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:02 Go to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 478
Registered: December 2010
Location: Germany
Senior Member
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 12:34 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6361
Registered: July 2009
Senior Member
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 13:13 Go to previous messageGo to next message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 478
Registered: December 2010
Location: Germany
Senior Member
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 14:12 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6361
Registered: July 2009
Senior Member
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 15:02 Go to previous message
Christoph Keimel is currently offline Christoph KeimelFriend
Messages: 478
Registered: December 2010
Location: Germany
Senior Member
> 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:Cannot Get Access to the Main ToolBar
Next Topic:Different deployment products for RCP application with maven
Goto Forum:
  


Current Time: Sun Sep 24 05:13:51 GMT 2017

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

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