I have Googled this question and found plenty of code dating back to 2009 and thereabouts, but most of it does not work and the remainder does not answer my question.
I expected the application to be able to identify which forms are open, probably in an array, but I cannot find such an array anywhere in the object hierarchy. The Forms collection contains all the forms in the application whether they are open or not and I can't see anything the the properties of a Form that would tell me if it is open.
There must be a way, but I'm not finding it. Any help would be appreciated.
Kind regards,
Doug
[Solved] How to test if a form is open?
-
- Posts: 93
- Joined: Tue Nov 08, 2016 8:04 am
[Solved] How to test if a form is open?
Last edited by owlbrudder on Wed Mar 01, 2017 3:55 am, edited 1 time in total.
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
Fedora 26 Linux x86_64
Core i7, 8Gb
Re: How to test if a form is open?
A form won't be opened twice. When you double-click a form icon it will be loaded if required before its window comes up to the front. Why do you care?
In any case, the desktop object includes a collection of components. A form document is just an ordinary Writer document with an empty URL and a title like "MyDB.odb: Form1"
In any case, the desktop object includes a collection of components. A form document is just an ordinary Writer document with an empty URL and a title like "MyDB.odb: Form1"
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
- Posts: 93
- Joined: Tue Nov 08, 2016 8:04 am
Re: How to test if a form is open?
I am writing an application with potentially many forms and I don't want to clutter up the workspace with forms that have been in use but are no longer necessary to be open. Just being tidy, I suppose.Villeroy wrote:Why do you care?
Anyway, you have answered my question fully as you always do - thank you.
Kind regards,
Doug
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
Fedora 26 Linux x86_64
Core i7, 8Gb
-
- Posts: 93
- Joined: Tue Nov 08, 2016 8:04 am
Re: How to test if a form is open?
Doh! (Slaps forehead). I am closing each form when the user selects another activity, so I won't have lots of forms cluttering up the workspace. (Crawls back under rock muttering).owlbrudder wrote:I don't want to clutter up the workspace with forms
Anyway, it is interesting to know the Desktop object is where to look.
LibreOffice Version: 5.3.3.0
Fedora 26 Linux x86_64
Core i7, 8Gb
Fedora 26 Linux x86_64
Core i7, 8Gb