Hi Carsten,
Carsten Driesner wrote (5-5-2008 13:10)
Cor Nouws wrote:
I thought it was possible to hide (show) a toolbar with OOobasic as
follows:
oFrame = ThisComponent.CurrentController.Frame
oLayoutManager = oFrame.LayoutManager
sUrl="private:resource/toolbar/custom_toolbar_2828.xml"
A toolbar URL should not have an extension.
"private:resource/toolbar/custom_toolbar_2828" would be the correct URL.
hmm, stupid I missed that.
oToolbar = oLayoutManager.getElement( sUrl )
xray oToolbar ' > Null object
oLayoutManager.hideElement(sUrl)
So this does not seem to work (OOo 2.4.0)
If you want to show a toolbar you have to use the following methods of a
layout manager.
oLayoutManager.createElement(sUrl);
oLayoutManager.showElement(sUrl);
You cannot be sure that the toolbar already exists therefore you have to
call "createElement" first.
Hiding a toolbar just needs hideElement(sUrl) but best would be to use
destroyElement(sUrl) afterwards. DestroyElement(sUrl) destroys the real
low-level VCL UI element which otherwise would use system resources.
Thanks, very useful info.
Besides that, finaly I need to hide/show a toolbar that is installed
with an extension, so probably will not be found with the sUrl at all.
You have to know the unique ID of the toolbar to reference it. The best
way to would be to add the controlling code to the extension which
installs the toolbar. Otherwise you have to add this information to your
code.
Does not seem that difficult for me to add the name of a toolbar,
existing in an extension, to the code once.
Found out that the unique ID is in the WriterWindowState.xcu (and
others) as "addon_xxx.OfficeToolBar". Adding that to the code once seems
easier to me than creating toolbar, adding button and so on ;-)
(sorry, still necessary to do a little lazy)
Thanks a lot for you help!
Cor
PS Hope you had a nice vacation!
--
"The Year of 3" -2008- "Het jaar van 3"
Cor Nouws
Arnhem - Netherlands - nl.OpenOffice.org - marketing contact
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]