Supress display during processing

@karolus I’m sorry neither my German nor my python is up to this.

ThisComponent.CurrentController.Frame.ComponentWindow.Visible = False

ThisComponent.CurrentController.Frame.ComponentWindow.Visible = True

Just re-tested Hidden & Visible. Visible works while Hidden errors on closing the form. My testing is erratic today.

Done for now - above code should work for you.

Thanks, @philippe.s.levi, that looks helpful, but when I run it I get an exception :-

Message: /nome/buildsafe/source/libo-core/sfx2/source/doc/-sfxbasemodel.css:2953

which is Greek to me.

Thank you, @Ratslinger. That has cracked it.

In my experiments, the Hidden : True option works without errors if I use


@Pansmanser, this topic may be of interest to other users as well. Could you upload a test file(s)?


To hide form is (using your code after call to OpenForm):

oForm.CurrentController.Frame.ContainerWindow.Visible = False
oForm.CurrentController.Frame.ContainerWindow.Visible = True

provided that the form you are opening is the one to be reduced. It is confusing as all is just bits and pieces.


If it is not the form you are opening but the current form, then:

ThisComponent.CurrentController.Frame.ContainerWindow.Visible = False
ThisComponent.CurrentController.Frame.ContainerWindow.Visible = True

Yes, @sokol92 ‘hidden’ and ‘dipose’ works better. Thank you. If you post it as an answer, I’ll accept it.

to me too ! :frowning:

I found that … not very helpfull !


This exception occurs if the object behind this interface has been disposed before and can’t uphold its method specification anymore.

The implementation normally should implement the XComponent interface to indicate this possibility.

Developers Guide

Thank you, this is not necessary! I think that attentive readers will study the topic to the end. :slightly_smiling_face:

Thanks, @Ratslinger.

Your first suggestion certainly reduces the time my form is on screen to a mere flash, however the output file is empty. I guess that StarDesktop.CurrentComponent() is no longer the Form that I am trying to write to the file. Furthermore the wrong Frame is closed when attempting to close the form, even if I set Visible=True before closing the window.

The second version produces the same DisposedException as @philippe.s.levi’s method.

Is it not possible to use the Hidden property when opening?

Sorry, but you are likely changing focus as to which form is currently ThisComponent and without a complete working sample it will be difficult to test. Basically you need to independently save access to each form (ie the one loaded in OpenForm is ‘oForm’) and that is how you access and close the one you wish. Possibly save a reference to the ThisComponent form before opening the other.

Can you explain how you would do that, @sokol92 ? I don’t know how to set ‘hidden’ with a normal odt, never mind loading a form within base.

In the second macro snippet in your startup message, add before the last line:

oParams(2).name = "Hidden" : oParams(2).value = True

Accordingly, it is also necessary to change the upper bound in the oParams description (dim) from 1 to 2.
LO documents can be opened in hidden mode (I use this), forms - I don’t know. :confused:

@Ratslinger I’ve rewritten the original question including the complete macro. (Should I have been able to attach the database?)

Yes, @sokol92, thank you! That has achieved the hiding.
However, when saving the file, there is an IOException, presumably because there is nothing there.
And then it closes the wrong window!
(I’ve rewritten the original question.)

The proposal seems to be effectve if you has your form opened, then you have the reference and then you can hide It.
I think It is not really easy, and It needs to open the form in hidden way, then put your preferences and finally unhide It as the final result.
All with macros and I am not sure to be able to do that.
Probably somebody could find the path.

Please do. I withdraw my post and all my further input.

In my opinion, this would be wrong. Truth is always born as a result of trial and error, analysis of various approaches. Optimal solutions are not often the first to come to mind.