In order to access a text box (or any other control for that matter) in a dialog you have to get the control first, and then get the model for the control. Aferwhich, you can set the properties of the control model. The “model” is essentially all of the properties that you can set for a dialog control if you were in the dialog window of the LO Basic IDE. In the case of my text box, the property that I want to set is “text”. Of course, different controls have different properties that can be set. You have to look up the properties that can be set for the given control you are working with. A list of the properties for the control that you are working with is likely included in the tables of chapter 18 in Open office.org “Macros Explained” by Andrew Pitonyak. You can easily find this in pdf format if you Google it.
Below is the required syntax:
Dim oDoc as Object
Dim oLib As Object, myDlg As Object, oDlgField As Object, oTBmodel As Object
REM set oDoc object variable to the current document
oDoc = ThisComponent
REM Load "Standard" library
REM Load dialog libraries
oLib = DialogLibraries.GetByName("Standard")
REM set myDlg to dialog named "Dialog_Location"
myDlg = oLib.GetByName("Dialog_location")
REM create Uno object "myDlg" which creates the dialog
oDlg = CreateUnoDialog(myDlg)
REM obtain the control and control model
oTBmodel = oDlg.GetControl("TextField1").getModel()
REM set the text property of the text box to the string variable "anatomy"
oTBmodel.Text = anatomy
REM execute the dialog