Thank you very much for taking me on the right track again. Things become weird now.
Run this with apso being installed and replace the 2 names sreg and sqry with the names of a data source and parameter query:
import uno
from apso_utils import msgbox, mri
sreg = "MailMergeTables"
sqry = 'Param_Month'
ctx = uno.getComponentContext()
smgr = ctx.ServiceManager
def testParameters():
dtp = smgr.createInstance('com.sun.star.frame.Desktop')
doc = dtp.loadComponentFromURL('private:factory/swriter', '_default',0,())
view = doc.getCurrentController()
view.FormDesignMode = False
frm = doc.createInstance('com.sun.star.form.component.Form')
frm.DataSourceName = sreg
frm.CommandType = 1
frm.Command = sqry
frm.EscapeProcessing = True
doc.DrawPage.Forms.insertByIndex(0, frm)
doc.setModified(False)
frm = doc.DrawPage.Forms.getByIndex(0)
params = frm.Parameters
mri(frm)
MRI shows property Parameters as XIndexAccess and XEnumerationAccess with RealName, Type, TypeName for each parameter.
However, frm.Parameters is void.
MRI sees property Parameters within the passed form object but these objects are inaccessible.
EDIT: When I add this listener to my frm, MRI does not show the Parameters anymore, the init routine is called but approveListener is never called. In MRI the frm seems to be locked. isLoaded() = False. No movement possible.
class paramListener(unohelper.Base, XDatabaseParameterListener):
def __init__(self,):
self.params = None
msgbox("__init__")
def approveParameter(self, ev):
msgbox('approveParameter')
self.params = ev.Parameters
return True
EDIT: params = uno.invoke(frm, ‘getParameters’, ()) makes no difference. The object remains void.