I have several macros associated with buttons that do things on a form. I also have a “Save” button defined. If the update field buttons are clicked the form does not detect something has changed and the form “Save” button does not enable. The field shows the new value, and it’s saved if I use the built in save record icon. So, there must be a comprehensive list somewhere, that I haven’t found, of all the different methods for form objects. I experimentally tacked on a commit() to the end of the field object statement in the macro, and that did save the update, but I’d rather just mark a field as updated and then have the system enable the save button. The IDE doesn’t have an autocomplete feature for objects so I don’t want to sit and guess the syntax, and maybe there isn’t even a method.
Sub UpdateField
ThisComponent.Drawpage.Forms.getByName("MainForm").getByName("MyTextField").Text = "bla"
ThisComponent.Drawpage.Forms.getByName("MainForm").getByName("SaveUpdates").enabled
End Sub
So the above macro routine puts “bla” into the field “MyTextField”. This works fine. But the form has a defined “SaveUpdates” button that saves the record. Unfortunately that button is not enabled when the “MyTextField” is updated by the previous statement, even though the form shows the new “bla” value. So there must be a way to mark the field (MyTextField) on the form (MainForm) as having been changed so the form handler enables the “SaveUpdates” button.
If I manually change the field (MyTextField) the form handler does enable the button.
The next second statement is trying to enable the “SaveUpdates” button, but I really don’t care if the way to do it is mark the text field as modified, or mark the submit button as enabled or mark the form as having been modified.
I’ve looked at lots of documentation, and will continue to look and try and learn about the what LibreOffice macros and the document model works, but in the short term can anyone provide a quicker solution?