Carsten Driesner wrote:
Jan Holst Jensen wrote:
Hi.
I am confused by add-on toolbars. My add-on toolbar doesn't show up
when listing the LayoutManager's elements via
Sub ListToolbars
Dim x as Variant
Dim s as String
For Each x in
ThisComponent.GetCurrentController.GetFrame.LayoutManager.getElements()
s = s & x.ResourceURL & CHR$(10)
Next
MsgBox s, 0, "Toolbars in Component"
End Sub
All add-on toolbars show as "0" in this list instead of showing a
URL. The standard toolbars are "fully equipped" as seen by
Dim x as Variant
x =
ThisComponent.GetCurrentController.GetFrame.LayoutManager.getElement("private:resource/toolbar/standardbar")
Xray x
but if I check my own add-on toolbar in a very simple add-on
"doobiedoo.my.toolbar" (or any other add-on toolbar - I tried
installing a few)
Dim x as Variant
x =
ThisComponent.GetCurrentController.GetFrame.LayoutManager.getElement("private:resource/toolbar/addon_doobiedoo.my.toolbar")
Xray x
the returned object is rather naked and lacks all the properties
needed for manipulating its state. What's going on ?
Hi Jan,
What you see is intended design and correct. An add-on toolbar is
defined by a XCU-file and have no settings which can be changed. This
is related to the fact that changes have to be stored in the user
layer. Unfortunately if you deinstall an extension these user layer
data won't be removed. That would mean that your add-on toolbar won't
be removed, too. Therefore we decided to disable settings for add-on
toolbars. If you want to circumvent this design, what I cannot
recommend, then you can use the configuration API to make direct
changes to your Addons.xcu file. Please be aware that you and your
users would see the negative effects that I described before!
You can enable/disable button if you have a DispatchProvider that
controls the commands behind the buttons. This is a very complex task
if you want to do it in Basic.
Hi Carsten.
Thanks for the explanation. At least I am no longer confused.
I was trying to change settings to either change the button icon
according to an ON/OFF state or enable/disable one of two buttons
according to ON/OFF state. I have settled with just having both buttons
visible always and then flashing a notification when the button is used
without effect - e.g. pressing the "Turn OFF" button while in the OFF
state would notify the user that it's no use trying to turn things off
that are already off.
Cheers
-- Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]