Access Table Control Element with OOo Basic

Keyboard macros or custom scripts

Access Table Control Element with OOo Basic

Postby bolaabola » Sat Mar 29, 2008 12:04 am

Can anyone please tell how to access Table control element with OOo Basic?
To be more precise, I want to access column values in table control.
Can't find anywhere.
bolaabola
 
Posts: 3
Joined: Wed Mar 26, 2008 11:42 pm

Re: Access Table Control Element with OOo Basic

Postby QuazzieEvil » Sat Mar 29, 2008 4:09 am

you can access it by name from the form. the columns in the table control are also accesible by name

example:
Code: Select all   Expand viewCollapse view

TableControl=Form.getByName("MyTableControl")
Col1=TableControl.getByName("Col1")
Col2=TableControl.getByName("Col2")
REM and so forth.
QuazzieEvil
Volunteer
 
Posts: 283
Joined: Tue Dec 04, 2007 6:38 pm
Location: Houston, TX

Re: Access Table Control Element with OOo Basic

Postby bolaabola » Sat Mar 29, 2008 1:45 pm

Thanks for reading the post and answering.

What about the values of cell in that table?
For example, to access value of text box I use: oBox.Text = "some text"
What would be the property to access value of each cell.
Or possibly there is property to access values of all cells in certain column?
bolaabola
 
Posts: 3
Joined: Wed Mar 26, 2008 11:42 pm

Re: Access Table Control Element with OOo Basic

Postby QuazzieEvil » Sat Mar 29, 2008 5:22 pm

cells in a table control are regular form controls. so you can access their content in the same way
QuazzieEvil
Volunteer
 
Posts: 283
Joined: Tue Dec 04, 2007 6:38 pm
Location: Houston, TX

Re: Access Table Control Element with OOo Basic

Postby ouchd'greyt » Tue Jul 11, 2017 8:20 am

thank you guys for the code, but there's a message object variable not set. how can i set the form?
OpenOffice 4.1.2 on Windows 7
ouchd'greyt
 
Posts: 28
Joined: Wed Jun 28, 2017 4:41 am

Re: Access Table Control Element with OOo Basic

Postby ouchd'greyt » Tue Jul 11, 2017 10:48 am

I tried the code, but there was runtime error message says "object variable not set for this one

TableControl=Form.getByName("MyTableControl")

how to set with this one?
OpenOffice 4.1.2 on Windows 7
ouchd'greyt
 
Posts: 28
Joined: Wed Jun 28, 2017 4:41 am

Re: Access Table Control Element with OOo Basic

Postby UnklDonald418 » Wed Jul 12, 2017 10:08 pm

runtime error message says "object variable not set for this one

TableControl=Form.getByName("MyTableControl")

Have you defined Form?
How are you invoking the macro?
For instance if you are using a button Event then something like
Code: Select all   Expand viewCollapse view
Form = oEvent.Soure.Model.Parent

might work.

If you are trying to access form controls you need to use an object inspection tool.
There is a tutorial on the MRI tool
https://forum.openoffice.org/en/forum/viewtopic.php?f=74&t=49294
it has a handy feature, once you've navigated to the control or value you are seeking press <Ctrl>h and it will open a window showing code you can use in your macro.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the subject line
Apache OpenOffice 4.1.5 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 716
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Access Table Control Element with OOo Basic

Postby ouchd'greyt » Thu Jul 13, 2017 2:42 am

Hi UnklDonald418,

Thank you for your kindness..

It might help..
OpenOffice 4.1.2 on Windows 7
ouchd'greyt
 
Posts: 28
Joined: Wed Jun 28, 2017 4:41 am

Re: Access Table Control Element with OOo Basic

Postby ouchd'greyt » Thu Jul 13, 2017 8:38 am

QuazzieEvil wrote:you can access it by name from the form. the columns in the table control are also accesible by name

example:
Code: Select all   Expand viewCollapse view

TableControl=Form.getByName("MyTableControl")
Col1=TableControl.getByName("Col1")
Col2=TableControl.getByName("Col2")
REM and so forth.



hi would like to know how about the acquiring the data or the details under that column? :mrgreen: :mrgreen:
OpenOffice 4.1.2 on Windows 7
ouchd'greyt
 
Posts: 28
Joined: Wed Jun 28, 2017 4:41 am

Re: Access Table Control Element with OOo Basic

Postby UnklDonald418 » Thu Jul 13, 2017 4:25 pm

If you were using the MRI tool to inspect Col1 you would be able to see all the available properties, Including
CurrentValue
DataField
Name
It would then be easy to make assignments such as:
Code: Select all   Expand viewCollapse view
val1 = Col1.CurrentValue

You can also see a list of properties in the IDE by setting a Breakpoint and using the Watch tool.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the subject line
Apache OpenOffice 4.1.5 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 716
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 2 guests