LO Base issue clicking switchboard item to see data in form?

Please bear with me as I set up the situation.

I am using Base with Firebird. The database in question has several tables, and several data forms. A given data form opens a specific table.

In addition, I have added a main switchboard (NOT standalone) and two sub-switchboards (again, NOT standalone). Clicking a button on the main switchboard launches a macro which opens a sub-switchboard. Clicking a button on a sub-switchboard launches a macro which opens a data form with its underlying data.

HERE IS THE WEIRD THING (at least to me): LEFT-clicking to open the data form in this fashion results in NO UNDERLYING DATA being displayed or accessible UNLESS I exit the form and open it a second time. Subsequent CONSECUTIVE exits and openings of the same data form continue to display the underlying data. Every time I change to another data form, I have to repeat the process just described.

I tried bypassing the main switchboard and launching the data form straight from the sub-switchboard. The results are the same.

Bypassing the switchboard forms altogether and opening the data forms directly displays the underlying data – FIRST TIME EVERY TIME.

I would have thought my code might be at fault, EXCEPT I found a number of peculiar behaviors depending on how I clicked the sub-switchboard buttons to access the data form.

I found that RIGHT-clicking to open the data form from the sub-switchboard form opens the data form and displays the underlying data – FIRST TIME, EVERY TIME.

Interestingly enough, I ALSO found by playing around that double-clicking a sub-switchboard button opens a data form with NO UNDERLYING DATA EVERY TIME – no matter the sequence. However, I can immediately REOPEN the same form from the sub-switchboard with a single left-click and the UNDERLYING DATA APPEARS.

I’ve tried this database on two different computers with two different versions of LO (one computer is running the stable version, the other is running the fresh version). I get the same behavior in either case.

Does anyone have an explanation for what I would consider unusual behavior?

Laptop 1:
MSI GT780
16 GB RAM
64-bit i-7 quad core (8 threads)

running LibreOffice Version: 6.4.6.2 on Linux 4.15 Mint 19 (running on 500 GB SSD with a 250 GB SSD data drive)

Laptop 2:
Acer Spin 5
8 GB RAM
64-bit i-7 quad core (8 threads)

running LibreOffice Version: 7.0.0.3 on Linux 4.15 Mint 19 (running on 256 GB bootable persistent USB flash drive)

Hello,

Noting the data is only displayed after initial try leads me to believe a problem with a macro. Need a sample.

Hi Ratslinger:

As I indicated earlier, my first thought was a macro problem, too – but remember there is NO problem if I RIGHT-CLICK on a switchboard button to open the data form. Works EVERY TIME.

However, I have included two macros for your amusement. :slight_smile: The first is the macro launched by one of the switchboard buttons. The second is the macro called by the first macro and by any of the other switchboard button macros.

Here ya’ go:

Sub btn_Maintain_tbl_Borrowers_Click()

Dim strForm As String

strForm = "frm_Maintain_tbl_Borrowers"
OpenForm(strForm)

End Sub

Sub OpenForm(strForm As String)

Dim oDoc As Object, oForm As Object, oController As Object 

oDoc = ThisComponent
oController = oDoc.getCurrentController


oForm = ThisDatabaseDocument.FormDocuments.getByName(strForm)
oForm.open

End Sub

@LKeithJordan,

I have included two macros for your amusement.

Not looking for Amusement. Maybe someone else will be amused.

Edit:

Have no problem with posted code. Works without issue. None of the items you mention apply. Click button, form opens with data. First Time.

You may be using incorrect event. Best for button is Execute action

No sample provided - just guessing from here.

Works for me. Never had any right click problems with a button.

I was joking. It was a joke. Lighten up. (grin)

Any ideas what the problem could be?

I thought about a hardware incompatibility, but it happens on two totally different machines, running two different versions of the software.

Tired of guessing - need sample.

Hi Ratslinger:

I almost tried “Execute action” earlier today, based on a couple of videos I found, but decided there was no reason. I was using “Mouse button pressed.”

When I changed to “Execute action” just now, the problem disappeared. Thanks, man. You get the check mark. (grin)

One question: It appears from your comment and my new observation that “Mouse button pressed” should only be used INSIDE the form, NOT to launch something external to the form. Can you explain why?

Ratslinger - Just realized I can’t give you a check mark because you answered in the comments – so I upvoted your comment instead. Cut and paste your answer and I’ll give you a check mark if you want. Thanks again!

Hello,

The event used makes a difference in processing. Some take longer that others. When an event is too fast in completion, certain processes may not complete. In your case, “Mouse button pressed” needs a bit of slowing down. Your code will work with that event by inserting a wait statement:

Sub btn_Maintain_tbl_Borrowers_Click(oEvent)
    Dim strForm As String
    wait 300
    strForm = "frm_Maintain_tbl_Borrowers"
    OpenForm(strForm)
End Sub

Still, push buttons are most used with the Execute action event.

Thanks, Ratslinger. Excellent answer. Have a wonderful day.