Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Base: another way to say ThisComponent?

While trying to open a form at startup directly in Base, I see the virtue of having an alternative way to step into the LibreOffice object hierarchy. Upon the Open Document event, the global ThisDatabaseDocument never works, and the alternative ThisComponent will sometimes at first return an unexpected error: no introspection available:

image description

That, of course is only the error telling me I cannot tell the properties of ThisComponent; the functional error is that ThisComponent does not at the very first have any of the anticipated properties or methods.

In one of the charming quirks about LO Basic, if you Wait 50 then things often go back to the way they should have been at the first, but this leads me to the question: Does anyone know an alternative syntax for accessing the object hierarchy in Base, like the calls that would create the ThisComponent global variable from scratch? Perhaps the kind of syntax prevalent pre-2009 using something like com.sun.star.sdb.aplication.DatabaseObject.FORM or com.sun.star.document.OfficeDocument -- things like that. Would I need to write the macro in Java? Or, perhaps a way to call the document controller via another method.

I think the document-level events do not pass an event object to the macro, so that does not appear to be a possibility.

Base: another way to say ThisComponent?

While trying to open a form at startup directly in Base, Base via an LO Basic macro, I see the virtue of having an alternative way to step into the LibreOffice object hierarchy. Upon the Open Document event, the global ThisDatabaseDocument never works, and the alternative ThisComponent will sometimes at first return an unexpected error: no introspection available:

image description

That, of course is only the error telling me I cannot tell the properties of ThisComponent; the functional error is that ThisComponent does not at the very first have any of the anticipated properties or methods.

In one of the charming quirks about LO Basic, if you Wait 50 then things often go back to the way they should have been at the first, but this leads me to the question: Does anyone know an alternative syntax for accessing the object hierarchy in Base, like the calls that would create the ThisComponent global variable from scratch? Perhaps the kind of syntax prevalent pre-2009 using something like com.sun.star.sdb.aplication.DatabaseObject.FORM or com.sun.star.document.OfficeDocument -- things like that. Would I need to write the macro in Java? Or, perhaps a way to call the document controller via another method.

I think the document-level events do not pass an event object to the macro, so that does not appear to be a possibility.