Tuomas Räsänen wrote:
Hi,

I've been trying to find out how to hide UIElements in frames and come to a conclusion that the XLayoutManager interface is the key. Am I right? Alas, I haven't figured out how to do it properly. Following piece of code doesn't work. What should I do differently?

Object desktop = remoteServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", remoteContext);

XDesktop xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, desktop);

       XFrame xFrame = xDesktop.getCurrentFrame();

Object layoutManager = remoteServiceManager.createInstanceWithContext( "com.sun.star.frame.LayoutManager", remoteContext);
Don't create your own layout manager. Every frame has its own layout manager instance and you can retrieve it using the interface com.sun.star.beans.XPropertySet and "LayoutManager" as the key.

XLayoutManager xLayoutManager = (XLayoutManager)UnoRuntime.queryInterface(XLayoutManager.class, layoutManager);

       xLayoutManager.setVisible(false);
Correct call, but using the wrong layout manager instance. The created layout manager is not associated with any frame, therefore it cannot do anything useful.

Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to