• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem setMnemonic for Menu Items

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I have a problem using setMnemonic for selecting menu items. For example, if I have a menu with two options 'File' and 'Edit' and under 'Edit' I define a 'Find' option, I set the keyboard mnemonics 'F' for the mnemonic for both 'File' and 'Edit'> 'Find'.
Now here is the problem...When select 'Alt-E' the Edit menu is selected. Next, I select 'Alt-F' expecting to go to 'Find'. Instead, I go to 'File'.
Is this the correct behavior ? I tried several window applications and when I use the 'Alt'-keypress, I stay on the same menu, not jump around.
I know I can change the mnemonic for 'Find' and it works fine, but this is just an example of a bigger problem.
Thanks in advance,
-Mike Z.
 
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mike,

the problem is not with setMnemonic() instead u r trying to navigate in a wrong manner.
To go to Edit->Find menu u should use
Alt+E followed by just F (not Alt+F).

regards
deeksha
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Mike Z",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please choose a new name which meets the requirements.
Thanks.
 
Mike Z
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by deekasha gunwant:
Hi Mike,

the problem is not with setMnemonic() instead u r trying to navigate in a wrong manner.
To go to Edit->Find menu u should use
Alt+E followed by just F (not Alt+F).

regards
deeksha


Thanks,
My only concern is even though this does work ( using 'Alt+E', then 'F'), this doesn't work the same as other windows applications.
-Mike Z.
[This message has been edited by Mike Z (edited February 27, 2001).]
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Begging your pardon, unless I am reading what is happening wrong, that is the EXACT functionality of Windows Apps. If you are using IE, try this test.
Alt-E (opens the Edit menu) now press F (it should take you to the find in page dialog box)
Now try the same thing using your technique..
Alt-E opens edit menu (the same) Alt-F (opens File menu).
I do know that some applications will have shortcuts to commands that are buried in a menu somewhere and its possible that is what you were thinking.
Hope that helps...
 
deekasha gunwant
Ranch Hand
Posts: 396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ryan
you are absolutely correct.
regards
deekasha
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a similar problem to this one, in JDK 1.2.2 using swing. While Ryan is correct that mnemonics are single characters, i.e. Alt-F to activate the File Menu and 'n' to activate new, my users are complaining because the Alt acceleration is still active in the window even when the menu is open. For example:
I have a menu (E)dit with three options Cu(t), (C)opy, and
(P)aste. I also have a JButton (C)lose. If the user does everything correctly, they press Alt-E and 'c' to copy and Alt-C to close the window. If, though, they press Alt-E and Alt-C (forgetting to let go of the Alt key) the window closes.
In IE, Netscape, and several Linux apps, I've found that once the menu pops up, the Alt key is either stripped or deactivated. In IE try Alt-F Alt-O, the open window is activated. I'm assuming IE is stripping the Alt key and passing along only the 'o'. Now try Alt-F Alt-T. Nothing happens because 't' is not a hot key on the file menu. Here I'm assuming the Alt key is thrown away or the (T)ools menu would be activated, at least, that's how my swing gui behaves.
I've been trying to figure out a way to work around this by capturing the Alt key and discarding it as necessary, but haven't been able to get this to work.
I'd really appreciate any advice you can give me.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic