I Created two dialog . The Dialog A has Textfields and buttons to open and select files and copy their path to the text fields. It also has ComboBoxes filled automatically with the headlines taken from the different files selected by the user. The Dialog B contains also comboBoxes which should be filled automatically also after the user selects the files in the Dialog A . The dialog A has “Next” button so that when the user clicks on that, the dialog B is open. And the Dialog B has “Return” button so that when the user clicks on that he goes back to dialog B. The problem is that by moving from dialog A to B everytime they are re-executed each time and the textfields and Comboxes are emptied . How can i move from dialog A to B without losing the data inside those dialogs. Thanks
I have not tested this scenario, however, in the various Dialog Examples (python) I put together on Live LibreOffice Python UNO Examples I used event driven actions. When ever a dialog changes someting an event is triggered. The class that opens the dialog is subscribed to the dialog. In short when something happens in the dialog the underlying class stores the change.
I am thinking one approach to your issue is to have three classes. Class A
and class B
that do the work you are speaking of. A
and B
classes would could take advantage of events and in turn raise an event of their own. Class MyWork
would be responsible for launching A
and or B
depending on your configuration. Class MyWork
also can subscribe to events that are raised by A
and B
. This way class MyWork
is always aware of the state of A
and B
and can recreate the dialogs with the correct state as needed.
If this approach works for you then I can help if you want to use OOO Development Tools (OooDev) in your project.
OooDev has dialog controls and and an event engine already built in to make this rather simple.
Yes . But the program is for the company computer and i’m not allow to install python or anything else in the server. So i’m stuck with libre office basic to create macros
LibreOffice comes with its own Python runtime. Possibly you already installed Python.
Depending on your needs, OooDev
can be embedded directly into a document macro.
See: Calc Add Range of Data Example
You can use the property .Visible for Dialog, instead of the method .execute(). Or make the whole dialog handly with listeners for closing cross.