On 25.05.2011 12:06, Rony G. Flatscher wrote:

Are you sure that you don't talk about accelerators (those who are
assigned to commands using tools-customize-keyboard)?
O.K., I think the best is that I show you the code snippets then.

The code is in ooRexx but excersises the Java API "behind the curtain".
The tilde in ooRexx is the message operator, so left of the tilde is the
receiving object, right of it the message. In case a queryInterface() is
needed, the ooRexx UNO support allows one to merely send the unqualified
interface name to the UNO object in order to retrieve that interface.

Line comments start with two consecutive dashes (--), block comments are
C-like (but can be nested in the Rexx language).

Having said that, here's the snippet, which should give you the exact
information, please look for the area after the comments lead in as "/*

(snip)

    /* *** shortcut *** */
              -- got shortcut manager, define key with Shift+Alt combination
           oShortCutManager=x_UIConfigurationManager~getShortcutManager
           xShortCutManager=oShortCutManager~XAcceleratorConfiguration

           modifiers =bsf.getConstant("com.sun.star.awt.KeyModifier", "SHIFT")  
-- Shift-key
           modifiers+=bsf.getConstant("com.sun.star.awt.KeyModifier", "MOD2")   
-- Alt-key

           KeyEventClz=bsf.importClass("com.sun.star.awt.KeyEvent")
Exactly, these are accelerators, not shortcuts. This is not about the words (others might even use them the other way around), but about the way they are executed.

In OOo accelerators work independently from any other UI elements, e.g. menu or toolbar items. In the default configuration "CTRL-O" will always execute the command ".uno:Open", even if no toolbars or menus are present.

OTOH, the *menu shortcut* (specified by putting a tilde in front of the letter "O" in a corresponding menu item label) for this function "ALT-F, O" (in the English version) can only be used by operating the menu with the keyboard.

A comparable functionality does not exist for toolbar items. Thus, a tilde in a toolbar item label does not have any effect and is just considered as garbage.

OTOH, toolbar quickhelp texts can show *accelerators* that are configured for the same functionality, in the same way as the menus do. (We don't do that in the item text as in menus as space in toolbars is more limited.)

The quickhelp for the "Open" button shows "Open (CTRL+O)" because "CTRL+O" is the accelerator for the ".uno:Open" command (in the default configuration that may be changed via "tools-customize-keyboard"). And the menu item for "Open" also shows "CTRL+O".

There is some code in OOo's framework that adds the accelerators to the label or quickhelpt text. In menus this code works immediately as menus are always created at the very moment they are opened. Toolbar quickhelp texts need an update notification when the shortcut was changed. As it seems, this update notification is not sent. But the quickhelp text of a new document would be correct as the accelerator is already known when the toolbar is created.

As an example, I configured "SHIFT-ALT-G" for "Insert-Gallery" in the keyboard configuration. The "view" menu (don't ask me why the menu has it in "view", the config in "insert" ;-)) immediately shows the new accelerator, the toolbar quickhelp doesn't. If I now open a new document, its toolbar shows the accelerator in the quickhelp text of the "Gallery" button.

Regards,
Mathias

--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
Please don't reply to "nospamfor...@gmx.de".
I use it for the OOo lists and only rarely read other mails sent to it.
--
-----------------------------------------------------------------
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help

Reply via email to