libreoffice base macro parametric open close get current form name -
libreoffice base 4.3.3.2 opening form page name , close current page form work:
oform = thisdatabasedocument.formdocuments.getbyname("secondform") oform.open oformc = thisdatabasedocument.formdocuments.getbyname("currentform") oformc.close
but there way close oformc without writing hand name?
trying with:
oformc = event.source.model.parent oformc = thisdatabasedocument.formdocuments.getbyname(event.source.model.parent) oformc = getparent()
return error of var not set
can't find in documentation.
the term 'form' in libreoffice/openoffice confusing because refers both entire document (typically writer file) , each group of form controls inside document. each form document can have many forms (meaning group of controls) inside it, , forms (groups of controls) can have sub-forms.
this code gets form document (a writer file embedded inside base file):
odoc = thisdatabasedocument.formdocuments.getbyname("secondform")
this code gets form group of controls , contains control triggered macro: oform = event.source.model.parent
way group of controls inside form document in macro triggered: oform = thiscomponent.drawpage.forms.mainform
replace "mainform" actual form name - form here meaning group of controls. can see names of forms , subforms inside form document opening form navigator window. make sure toolbar form design visible; form navigator icon sixth left or top, looks rectangle compass in upper right corner.
you may have guessed previous code how close document active when macro triggered:
thiscomponent.close