Welcome beginner. Please answer all of the questions below which may provide information necessary to answer your question.
-----------------------------------------------------------------------------------------------------------
Which version of OpenOffice.org are you using? 2.4.1
What Operating System (version) are you using? XP
What is your question or comment?
I am creating a dialog with several TextField boxes and I want to be able to scan through them and get the data from each one in turn. In VBA this would be a 'collection of objects' that would be accessed as:
For each t in TextBox REM enumerate textboxes
a(n) = t.Text REM Put data int an array
n+=1 REM increment array element
next t REM next textbox
How can this be translated into OO BASIC?
Thanks...
[Solved]How are objects on a dialog accessed as a collection
[Solved]How are objects on a dialog accessed as a collection
Last edited by grnhorn on Sun Jul 13, 2008 9:00 pm, edited 1 time in total.
OOo 2.4.X on Ms Windows XP
Re: How are objects on a dialog accessed as a collection?
From the excellent document written by Andrew Pitonyak (http://www.pitonyak.org/AndrewMacro.odt):
Code: Select all
x = oDlg.getControls()
For ii=LBound(x) To UBound(x)
Print x(ii).getImplementationName()
Next
LibreOffice 4.2.3.3. on Ubuntu 14.04
Re: How are objects on a dialog accessed as a collection?
Thanks squenson for the reply and the code worked and returned all of the control names. What I am trying to do is return the Text from the TextFields only. VBA gives the ability to enumerate through a control collection by position and return the property that is needed. In other words, VBA places the control into an array based upon when it is placed on the dialog. If all the TextBoxes are place on the dialog at one time, then they are consecutive in the array. This ID is part of VBA'a properties. This is where I am lost in OO. I have looked through Andrew's macros, along with hours on the internet, and the answer did not jump out at me.
Thanks...
Thanks...
OOo 2.4.X on Ms Windows XP
[Solved] How are objects on a dialog accessed as a collectio
Solution:
x = oDlg.getControls()
For ii=LBound(x) To UBound(x)
If x(ii).getImplementationName() = "stardiv.Toolkit.UnoButtonControl" Then Print x(ii).AccessibleContext.AccessibleName
Next
This will return the control name based upon an index number (ii) and type of control ("stardiv.Toolkit.UnoButtonControl"). Link to get the "Uno____Control" http://docs.sun.com/app/docs/doc/819-0439/faaji?a=view.
x = oDlg.getControls()
For ii=LBound(x) To UBound(x)
If x(ii).getImplementationName() = "stardiv.Toolkit.UnoButtonControl" Then Print x(ii).AccessibleContext.AccessibleName
Next
This will return the control name based upon an index number (ii) and type of control ("stardiv.Toolkit.UnoButtonControl"). Link to get the "Uno____Control" http://docs.sun.com/app/docs/doc/819-0439/faaji?a=view.
OOo 2.4.X on Ms Windows XP