Hi all,
I run LibreOffice 6.0.2.1.0+ (Build-ID: 1:6.0.2-1~bpo9+1) on Debian stretch. In a base document, connected to a PostgreSQL data base, I ran into a really confusing behaviour of forms.
The task: I have two forms. In the first, when the user clicks a button, the second form (managing a list of contacts) shall be opened for entering a new item. Following the manual, I wrote this macro and connected it to the “Execute action” of the button in the first form:
---8<----------------------------------------------------------------------------
Sub newContact
oDstForm = thisDatabaseDocument.FormDocuments.getByName("Kontakte verwalten")
oDstForm.open()
oMainForm = oDstForm.component.getDrawPage.getForms.getByName("ContactForm")
oMainForm.load()
oMainForm.afterLast()
oMainForm.moveToInsertRow()
End Sub
---8<----------------------------------------------------------------------------
This opens the form, but still displays the first entry, which should not happen.
Now for the /really/ puzzling part: In the macro editor add a breakpoint at any statement in the macro. Now step (shift-F8) through the remaining statements until “End Sub” is reached, and the form jumps to a new entry with all fields empty, i.e. does what I expect it to do.
When I place a ”wait 100” statement after “oDstForm.open()”, the form /also/ behaves properly, but I think this is not the correct solution. Any idea what goes wrong at this point, and what would be the correct approach?
Thanks in advance,
Albrecht.