Ariel,

Thank you very much!  I was already manipulating FeatureStateEvent to
enable and disable the menu items, but I didn't realize that State
holds the text of the menu item.  I added just a line of code and now
it works!

Keith

2014-10-16 14:16 GMT+02:00 Ariel Constenla-Haile <arie...@apache.org>:
> Hello Keith,
>
> On Thu, Oct 16, 2014 at 11:13:19AM +0200, Keith Alcock wrote:
>> API experts,
>>
>> This question below couldn't be answered in the forums, so I'll try here:
>>
>> I have a very nice addon programmed in C++ and the related menu items
>> are stored in Addons.xcu. The addon would be even nicer if I could
>> adjust the menu item texts as the user works, similarly to how the
>> undo, redo, and repeat items function in the edit menu. I can't figure
>> out how to get ahold of the XMenu associated with my addon. From there
>> it seems that I could use setItemText(). Who knows how to get that
>> XMenu and is willing to tell? Thanks.
>>
>> Additional information:
>>
>> I've seen examples (e.g.,
>> https://issues.apache.org/ooo/show_bug.cgi?id=6778 and
>> http://www.libreoffice-forum.de/viewtopic.php?f=12&t=12691) of how so
>> search through the standard OpenOffice menus, but I don't think that
>> the addon menu items are included based on the popupCount I get from
>
> You should *not* use the configuration API in order to change the text of
> the menu item (a single change will cause the whole menubar to be
> updated, and this is rather inefficient).
>
> The text of the menu items can be changed at runtime by sending a status
> update where the css.frame.FeatureStateEvent.State holds the string with
> the new menu item text.
>
> How does it work? The menu item is controlled in the application
> framework by an object that listens for status updates at the dispatch object
> you return in your ProtocolHandler implementation.
>
> For this to work, you may need to modify your implementation of the
> ProtocolHandler; usually, in most examples, like the ones on the SDK [1],
> the dispatch provider and the dispatch object are implemented in the
> same class and status listeners are not tracked.
>
> [1] For example
> <sdk>/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx
> https://svn.apache.org/viewvc/openoffice/trunk/main/odk/examples/DevelopersGuide/Components/Addons/ProtocolHandlerAddon_cpp/addon.cxx?revision=1413471&view=markup
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org
For additional commands, e-mail: api-h...@openoffice.apache.org

Reply via email to