I'm not able to get the GetByName function to work. Its' not able to retrieve either the form name, or control names.
I've transplated existing working code from another database and scoured the forums for examles, all which appear to indicate the coding is correct.
This problem has been holding me up for several weeks now, with no sign of a way forward.
Have I just made a simple stupid mistake?
I'm operating LibreOffice 5.1.6.2 on Ubuntu 16.04, and Windows 7
In the example below, I setup a new database with a single form called "MyTestForm" containing a single text box "TextBox1"
The following code is triggered on the TextModified event. (Text Changed ...Standard.FormModule.AfterTextBoxUpdate (document, Basic)"
Code: Select all
option explicit
sub AfterTextBoxUpdate(ctrl as control)
'
' After updating the textbox, display contents in a MsgBox
' then change it.
'
' add the usual form variable set.
Dim oDoc As Object
Dim oDocCtrl As Object
dim oDrawpage as object
Dim oForm As Object
Dim otxtBox as object 'Committee drop down box
oForm=ctrl.source.Model.Parent
msgbox oForm.name 'WORKS - displays the form name "MyTestForm"
oDoc = ThisComponent
oDrawpage = oDoc.Drawpage
oForm = oDrawpage.Forms.getbyName("MyTestForm") ' FAILS
'Error Message : Type: com.sun.star.container.NoSuchElementException Message: .
'
'
end sub