[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher

On 25.05.2011 08:35, Mathias Bauer wrote:
 On 24.05.2011 22:31, Rony G. Flatscher wrote:
 Hi there,

 in the meantime I have been able to add shortcuts to the toolbar items
 and they are operational. However, the shortcut letter is not
 underlined, although using the tilde (~) before the letter to be
 underlined in the Label property of the toolbar item.

 Is there a different property that I would need to use for having OOo
 underline the shortcut-key?
 (Again it works, using SHIFT+ALT+letter, where ALT is the META2
 KeyModifier.)

 TIA,

 ---rony




 What do you mean by again it works, using SHIFT+ALT+LETTER ?
Just that the defined shortcut-keys are operational. E.g. the shortcut
for the ~Import toolbar item gets defined as SHIFT+META2+I and if you
press SHIFT+ALT+I (META2 is ALT on my Windows keyboard) the toolbar item
gets executed. It is just the case that the I does not get underlined
in the toolbar item (a button where the text and the assigned icon get
displayed).

For usability it would be desirable to underline the shortcut letter in
the toolbar text.

---rony
-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Fernand,

On 25.05.2011 09:15, Fernand Vanrie wrote:

 When making mi extentions i found (by accident if forgot to use ~) 
 the system (at least for menubar items) automaticly gives a underlined
 letter
thank you for that hint. Unfortunately, this does not work either.

---rony

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Mathias Bauer

On 25.05.2011 10:34, Rony G. Flatscher wrote:


On 25.05.2011 08:35, Mathias Bauer wrote:

On 24.05.2011 22:31, Rony G. Flatscher wrote:

Hi there,

in the meantime I have been able to add shortcuts to the toolbar items
and they are operational. However, the shortcut letter is not
underlined, although using the tilde (~) before the letter to be
underlined in the Label property of the toolbar item.

Is there a different property that I would need to use for having OOo
underline the shortcut-key?
(Again it works, using SHIFT+ALT+letter, where ALT is the META2
KeyModifier.)

TIA,

---rony





What do you mean by again it works, using SHIFT+ALT+LETTER ?

Just that the defined shortcut-keys are operational. E.g. the shortcut
for the ~Import toolbar item gets defined as SHIFT+META2+I and if you
press SHIFT+ALT+I (META2 is ALT on my Windows keyboard) the toolbar item
gets executed. It is just the case that the I does not get underlined
in the toolbar item (a button where the text and the assigned icon get
displayed).


Sorry for being dense ;-), where did you define the shortcut? If a 
shortcut is defined in a menu, it will executed only if the menu has the 
focus. I don't think that this works in toolbars. If I just ad a tilde 
to a toolbar item label, I don't see a way to execute this label as a 
command like in a menu.


Are you sure that you don't talk about accelerators (those who are 
assigned to commands using tools-customize-keyboard)?


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


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher

On 25.05.2011 11:22, Mathias Bauer wrote:
 On 25.05.2011 10:34, Rony G. Flatscher wrote:

 On 25.05.2011 08:35, Mathias Bauer wrote:
 On 24.05.2011 22:31, Rony G. Flatscher wrote:
 Hi there,

 in the meantime I have been able to add shortcuts to the toolbar items
 and they are operational. However, the shortcut letter is not
 underlined, although using the tilde (~) before the letter to be
 underlined in the Label property of the toolbar item.

 Is there a different property that I would need to use for having OOo
 underline the shortcut-key?
 (Again it works, using SHIFT+ALT+letter, where ALT is the META2
 KeyModifier.)

 TIA,

 ---rony




 What do you mean by again it works, using SHIFT+ALT+LETTER ?
 Just that the defined shortcut-keys are operational. E.g. the shortcut
 for the ~Import toolbar item gets defined as SHIFT+META2+I and if you
 press SHIFT+ALT+I (META2 is ALT on my Windows keyboard) the toolbar item
 gets executed. It is just the case that the I does not get underlined
 in the toolbar item (a button where the text and the assigned icon get
 displayed).

 Sorry for being dense ;-), 
That's o.k., as I have no idea what the relevant information is when
reporting this observation. So dense questions hopefully help clarify.

 where did you define the shortcut? If a shortcut is defined in a menu,
 it will executed only if the menu has the focus. I don't think that
 this works in toolbars. If I just ad a tilde to a toolbar item label,
 I don't see a way to execute this label as a command like in a menu.

 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 /*
*** shortcut *** */:

::routine BNF_toolbar   -- rgf, 2011-05-21: create toolbar for writer module
   use arg xContext, install=.true, location=user   -- location: Rexx 
scripts location

   -- define where to store the toolbar
   ToolbarURL = private:resource/toolbar/custom_bnf4oootoolbar

   -- get the user interface configuration
   x_MultiServiceFactory = xContext~getServiceManager~XMultiServiceFactory

   configsupplier = com.sun.star.ui.ModuleUIConfigurationManagerSupplier
   x_Supplier = 
x_MultiServiceFactory~createInstance(configsupplier)~XModuleUIConfigurationManagerSupplier
   
   -- the document type this toolbar is bound to
   DocumentType = com.sun.star.text.TextDocument
   -- get the user interface configuration of writer
   x_UIConfigurationManager = 
x_Supplier~getUIConfigurationManager(DocumentType)

  -- define macros and sequence for toolbar
   arrMacro =.array  ~of(OOoBNF2Diagram.rex, OOoBNF2All.rex, -
 OOoBNF2XML.rex, OOoXML2BNF.rex, -
 OOoImport.rex , OOoExport.rex , -
 OptionGUI.rex , addBNF4OOoStyles.rex , 
-
 installBNF4OOo.rex)

/* *** shortcut *** */
  -- in toolbars the label text does not underline the shortcut char 
indicated with the tilde '~'
   arrMacroLabel=.array  ~of(BNF2~Diagram   , BNF2~All   , -
 BNF2~XML   , XML2~BNF   , -
 ~Import, ~Export, -
 ~Options   , Add BNF4OOo ~Styles ,-
 ~Uninstall BNF4OOo )

/* *** shortcut *** */
  -- define shortcut key for macros
   arrShortCuts=.array   ~of(D, A, X, B, I, E, O, S, U)


---
  -- build macro urls
   arrMacroURL=.array~new
   do i=1 to arrMacro~items -- a.k.a. commandURLs
  
arrMacroURL[i]=vnd.sun.star.script:BNF4OOo.arrMacro[i]?language=ooRexxlocation=location
   end

  -- define built-in icons to be used for our toolbar items
   arrBuiltinIcons=.array~of(.uno:Imagebutton, 
.uno:ArrowShapes.striped-right-arrow,  -
 .uno:ArrowShapes.right-arrow, 
.uno:ArrowShapes.left-arrow, -
 .uno:ImportDialog   , .uno:ExportTo, - -- 
.uno:ExportDialog, -
 .uno:FormDesignTools, .uno:StyleApply, -
 .uno:Delete)

  -- build image name 

[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Mathias Bauer

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


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Mathias,

thank you very much for your explanations!A comparable functionality
does not exist for toolbar items.

... cut ...

 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.
How can I define a quickhelp text for each toolbar item? It seems that
by default the label of the toolbar item is used as the quickhelp
(tooltip?) text, and that does not exhibit the shortcut key by
underlying it.

 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.
Just tried this via Tools-Customize, but it did not work with the
toolbar item.

---rony

P.S.: One observation: it is not possible to delete the programmatically
created toolbar using Tools - Customize as the delete option is
greyed out. One can delete the individual toolbar items and make the
toolbar empty and on the next restart the toolbar seems to have gone.

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Mathias Bauer

On 25.05.2011 14:32, Rony G. Flatscher wrote:


How can I define a quickhelp text for each toolbar item? It seems that
by default the label of the toolbar item is used as the quickhelp
(tooltip?) text, and that does not exhibit the shortcut key by
underlying it.


Indeed the quickhelp text is the label. It *should* exhibit the shortcut 
key that is assigned to the same command as the toolbar item, if you 
make sure that the keyboard configuration was created before the toolbar 
was created. If not, this would be a missing feature ;-).


As I wrote, the accelerator key was shown for built-in commands and for 
basic macros. So I don't see a general reason why it shouldn't work for 
scripts.



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.

Just tried this via Tools-Customize, but it did not work with the
toolbar item.


*what* did you try? My example with .uno:Gallery or your script/macro?

In case you didn't notice, it is necessary to create the toolbar *after* 
you have configured the shortcut, e.g. by opening a new document window.



P.S.: One observation: it is not possible to delete the programmatically
created toolbar using Tools -  Customize as the delete option is
greyed out. One can delete the individual toolbar items and make the
toolbar empty and on the next restart the toolbar seems to have gone.


I don't know if this is a bug or by intent, sorry.

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


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Hi Mathias,

On 25.05.2011 16:40, Mathias Bauer wrote:
 On 25.05.2011 14:32, Rony G. Flatscher wrote:

 How can I define a quickhelp text for each toolbar item? It seems that
 by default the label of the toolbar item is used as the quickhelp
 (tooltip?) text, and that does not exhibit the shortcut key by
 underlying it.

 Indeed the quickhelp text is the label. It *should* exhibit the
 shortcut key that is assigned to the same command as the toolbar item,
 if you make sure that the keyboard configuration was created before
 the toolbar was created. If not, this would be a missing feature ;-).

 As I wrote, the accelerator key was shown for built-in commands and
 for basic macros. So I don't see a general reason why it shouldn't
 work for scripts.

 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.
 Just tried this via Tools-Customize, but it did not work with the
 toolbar item.

 *what* did you try? My example with .uno:Gallery or your script/macro?
Your example.

 In case you didn't notice, it is necessary to create the toolbar
 *after* you have configured the shortcut, e.g. by opening a new
 document window.
Did try that, even shut down all instances of OOo writer.

It's OOo 3.2.1 though, so maybe that does not work with that old version?

In any case I changed the program to first define and store the
accelerations and then create the toolbar items.

Probably I will add a menu in addition, hoping that it will underline
the shortcut letters.



 P.S.: One observation: it is not possible to delete the programmatically
 created toolbar using Tools -  Customize as the delete option is
 greyed out. One can delete the individual toolbar items and make the
 toolbar empty and on the next restart the toolbar seems to have gone.

 I don't know if this is a bug or by intent, sorry.
No problem.

Thank you *very* much for your help and insights!

Best regards,

---rony

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Mathias Bauer

On 25.05.2011 17:35, Rony G. Flatscher wrote:


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.

Just tried this via Tools-Customize, but it did not work with the
toolbar item.


*what* did you try? My example with .uno:Gallery or your script/macro?

Your example.


In case you didn't notice, it is necessary to create the toolbar
*after* you have configured the shortcut, e.g. by opening a new
document window.

Did try that, even shut down all instances of OOo writer.

It's OOo 3.2.1 though, so maybe that does not work with that old version?


Hm, probable. I tested with 3.3. Maybe if I come across a 3.2.1 I might 
try it again.


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


[api-dev] Re: Toolbar items: how to get them to show the shortcut letter underlined ?

2011-05-25 Thread Rony G. Flatscher
Hi Mathias,

sorry for the noise, the accelerators work correctly for both menu and
toolbar items.

The problem: during different test runs I created accelerators with
Shift+Ctrl and for Shift+Alt without ever removing the accelerators upon
uninstall. Therefore both sets of accelerators were operational, where
for the menus the Shift+Ctrl shortcuts got used.

After removing the accelerators with removeCommandFromAllKeyEvents()
upon uninstall fixed the problem from then on.

---rony


On 25.05.2011 23:09, Rony G. Flatscher wrote:
 Hi Mathias,

 maybe one more question: in addition to the toolbar I have created a
 menubar and all menu-items match the toolbar items (CommandURL, Label,
 etc.).

 The menus also work and show the icons and in addition they show the
 accelerator keys.

 *However*, the menu item accelerators show Shift+Ctrl, whereas the
 toolbar item accelerators (which are the only ones that got defined by
 my program) were defined with Shift+Meta2 (i.e. Shift+Alt). Both set
 of accelerators are operational!

 Is there a possibility to have the menu display and use the accelerator
 that got defined, i.e. Shift+Meta2?

 TIA,

 ---rony





 On 25.05.2011 18:01, Mathias Bauer wrote:
   
 On 25.05.2011 17:35, Rony G. Flatscher wrote:

 
 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.
 
 Just tried this via Tools-Customize, but it did not work with the
 toolbar item.
   
 *what* did you try? My example with .uno:Gallery or your
 script/macro?
 
 Your example.

   
 In case you didn't notice, it is necessary to create the toolbar
 *after* you have configured the shortcut, e.g. by opening a new
 document window.
 
 Did try that, even shut down all instances of OOo writer.

 It's OOo 3.2.1 though, so maybe that does not work with that old
 version?
   
 Hm, probable. I tested with 3.3. Maybe if I come across a 3.2.1 I
 might try it again.

 Regards,
 Mathias 
 
   

-- 
-
To unsubscribe send email to dev-unsubscr...@api.openoffice.org
For additional commands send email to sy...@api.openoffice.org
with Subject: help