Marco Castillo schrieb:
Thank you Carsten for your kind reply. I don't want to make the changes
persistant. I just need this changes to be done within the applet, and only in
the applet. Could you send me some code snippets for this or show me a link
where I can find them?
Again thank you in advance for your kind reply.
Hi Marco,
You can find the Basic macro code to set the "Save" button on the
"Standardbar" invisible at the end of my answer. It's the non-persistent
version. Just try it out. If you want to remove the button use
removeByIndex() in the code below.
Regards,
Carsten
----------
Sub Main
REM *** Initialize strings
sToolbar = "private:resource/toolbar/standardbar"
sCmdId = ".uno:Save"
REM *** Retrieve the desktop service
oDesktop = createUnoService("com.sun.star.frame.Desktop")
REM *** Retrieve the current frame and layout manager
oCurrFrame = oDesktop.getCurrentFrame()
oLayoutManager = oCurrFrame.LayoutManager
REM *** Try to retrieve the toolbar from the layout manager
oToolbar = oLayoutManager.getElement( sToolbar )
REM *** Retrieve settings from toolbar ***
oToolbarSettings = oToolbar.getSettings( true )
index = -1
nCount = oToolbarSettings.getCount()
for i = 0 to nCount-1
oToolbarButton() = oToolbarSettings.getByIndex( i )
nToolbarButtonCount = ubound(oToolbarButton())
for j = 0 to nToolbarButtonCount
if oToolbarButton(j).Name = "CommandURL" then
if oToolbarButton(j).Value = sCmdId then
index = i
end if
endif
next j
next i
if index <> -1 then
REM *** Retrieve current Persistent state
REM *** from property
bPersistent = oToolbar.Persistent
REM *** To make our changes non-persistent
REM *** we have to set the Persistent property
REM *** to false
oToolbar.Persistent = false
REM *** Retrieve button settings
oButtonSettings = oToolbarSettings.getByIndex( index )
REM *** Change the visibility property of the button
for j = 0 to ubound(oButtonSettings())
if oButtonSettings(j).Name = "IsVisible" then
oButtonSettings(j).Value = FALSE
endif
next j
REM *** Replace button settings
oToolbarSettings.replaceByIndex( index, oButtonSettings )
REM *** Set new settings at our toolbar
oToolbar.setSettings( oToolbarSettings )
REM *** Reset Persistent property to old value
oToolbar.Persistent = bPersistent
end if
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]