Kevin Yank wrote: > I am trying to modify a couple of the default menu accelerators in XXE > and am running into problems. From reading the mailing list archives, it > appears this is one area of XXE that has evolved quite a bit over the > past few major releases. > > Specifically, I want to modify the accelerators for *Window > Show > Preceding* and *Window > Show Following* (Ctrl-Shift-P, Ctrl-Shift-F in > default.xxe_gui), so that they are triggered by Ctrl+Shift+Tab and > Ctrl+Tab, respectively. > > Here is the code I have used in my custom.xxe_gui file: > > <?xml version='1.0' encoding='UTF-8'?> > <gui xmlns="http://www.xmlmind.com/xmleditor/schema/gui" > xmlns:gui="http://www.xmlmind.com/xmleditor/schema/gui"> > > <include location="xxe-gui:app/default.xxe_gui" /> > > <action name="precedingWindowAction" label="Show _Preceding" > accelerator="mod shift TAB"> > <class>com.xmlmind.xmleditapp.app.part.PrecedingWindowAction</class> > </action> > > <action name="followingWindowAction" label="Show _Following" > accelerator="mod TAB"> > <class>com.xmlmind.xmleditapp.app.part.FollowingWindowAction</class> > </action> > > <layout> > <insert/> > </layout> > </gui> > > Unfortunately, this does not have the desired effect. Here's what I'm > seeing: > > * Although the *Window > Show Preceding* menu item does display the > correct accelerator (Ctrl+Shift+Tab), typing Ctrl+Shift+Tab does > not trigger this action. > * Apparently because a default binding exists for Ctrl+Tab to the > insertControlCharacter command, *Window > Show Following* loses > its accelerator -- no accelerator key is displayed in the menu item.
Your analysis is correct. > Here are my questions: > > * Why does the Ctrl+Shift+Tab not work as an accelerator key for > *Window > Show Preceding*? You cannot bind the Tab key (as is or combined with modifiers such as Shift, Ctrl, etc) to actions. The Tab key is ``reserved'' by the ``Java GUI engine'' to walk through keyboard-enabled GUI components[*]. Similarly, it would be a bad idea to use the Alt modifier for any kind of shortcut. > * Is it possible to override a default binding with a menu accelerator? No. Default bindings have priority over menu shortcuts. For example, if, in customize.xxe, you bind a command such as "recordMacro toggle" to Ctrl-O, then File|Open would loose its shortcut. We'll update http://www.xmlmind.com/xmleditor/_distrib/doc/gui/action.html to make this point very clear. --- [*] Unlike the standard javax.swing.JTabbedPane, the custom tabbed pane containing the document views is *not* a keyboard-enabled GUI component.

