Update db form right after it's done loading

I have created a form in LibreOffice Base. Some form fields need to be manipulated each time I change to another record.
For example there’s a field that holds the name of an image. When the record is shown, this name is used to display this image at true size in another field. I have a python macro that is connected to the “After Record Update” event for this.

It works well, except when the form is first loaded. When loading the form the “After Record Update” event is not triggered for the initial record to show. Looking at the form’s available events I thought perhaps to attach the same code to the “When Loading” event. This fails however because at that stage the form’s DrawPage is not yet available so I can’t go in and edit form controls.

So I’m a bit at a loss here. What event should I listen for to be able to change form controls right after the form has loaded ?

Hello,

You are in the wrong area. You seem to be looking at the events for an internal form and should be looking at the external form events.

Edit the form you want the update to occur on when opening. From the menu select Tools->Customize.... Then on the Events tab attach your macro. Most often what works is the Open Document event. In some cases you may need to use the View Created event. Document loading finished may also work.

Unfortunately do not seem to have any list of descriptions for these. If found will post.

1 Like

It never occurred to me there would be a higher level for these events.

Thanks a lot. That solved my issue.

The events are NOT consistently triggered for base record navigation.

@MarathonMike,

What events are triggered are certainly dependent upon the action performed. Record navigation is questionable here as many of these events noted in the answer are prior to the actual data being available.

Have published other answers explaining how to open forms at specific records.

Thank Ratslinger. I see where I got messed up and you got me back on track. Now that I’m picking the right event, for me, the “After Record Update” is always triggered for the initial record to show. I guess I let Geert’s original question confuse me. Geert may be having some variation of the “initial record” problem, but luckily I’m not seeing it. Perhaps it’s somehow connected to Geert’s use of Python. I’m using the old fashioned Basic. (Not saying it’s better,)