I put this page together of things i had looked at as I went along to help the next guy, who might be you at this moment.
The best advice I can give you are two things:
1) If you haven't already done so install MRI and learn to use it.
- Start by creating a simple macro that calls MRI from an event and stops (see example below).
- Hook this macro to the event that you think you want to use.
- Start to explore with MRI by drilling down (by double clicking) into the object collection, or backing up (with the left arrow) and trying again.
- Important places (methods) to look are
model
, parent
, and getbyname
. - Take some time to study all of the property values. Make sure you learn to be able to click on an object and get the interface help for it with the IDL Ref. button. (BTW, I still can't get MRI to correctly use the LibreOffice API. So for now I'm still using the OpenOffice API.)
- Remember that each Property is derived from a Method. There are only methods in the UNO interface.
It took me awhile to learn to use MRI. I even rewrote parts of the MRI wiki at the git site once I finally understood it. MRI has been an immense help to me.
=== Object Catalog ===============================================================================
My Macros & Dialogs
MRILib
Module1
LoadMriLibrary
Mri
=== My Macros & Dialogs / MRILib / Module1 =======================================================
Option Explicit 'BASIC ###### MRI ######
' --- Helper to run Mri ------------------------------------
' Usage: Mri [optional object to initially target]
'
Sub Mri( ByVal Optional MriTargetObject )
On Error GoTo ShowError
If IsMissing( MriTargetObject ) Then MriTargetObject = StarDesktop 'default target
CreateUnoService( "mytools.Mri" ).inspect( MriTargetObject )
Exit Sub
ShowError:
msgbox "Error: " & Error
End Sub
Private Sub OpenDocument()
LoadMriLibrary
End Sub
=== Example: calling for testing =========================================================
' --- Helper to load MRILib library ------------------------
Sub LoadMriLibrary()
Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
End Sub
Private Sub SubForm_Grid_When_Recieving_Focus(oEvent As Object)
mri oEvent: stop
End Sub
2) Spend some time reading everything you can find on the subject. The documentation is somewhat scattered. Unless this has changed some of the best help and technical documentation still comes from OpenOffiice rather than from LibreOffice.
I'm not 100% sure, but I think sequence error seems to appear when you try and create another record, but before saving a modified record. I think I sometimes see it when inserting a new record, especially when inside a macro which does record work.