Is it possible in Vision to get Power Table position and column widths through scripting?

I got a vision project where some production data is displayed using a power table with three visible columns. By clicking into the table a popup window is loaded visualizing the content of the row that got clicked.
Now I would like to set position and size of popup window according to screen size (size of MainWindow, gets opened full screen by default), so that the popup window is located right to the first coulmn, using the rest of screen.
Is it possible to get the position of the power table inside the main window and get the width of the first column by scripting?

Yes, you should be able to do that with something like this: (untested)

myTable = <path to your table component>
tableX = myTable.getX()
tableY = myTable.getY()
firstColumnWidth = myTable.getColumnWidth(0) ## 0 refers to first column index
2 Likes

Thank you for your reply.
.getX() and .getY() worked but .getColumnWidth(0) throws error: object has no attribute 'getColumnWidth'
how did you know that .getX() exists? I could not find it in documentation neither for Vision scripting (Scripting in Vision - Ignition User Manual 8.0 - Ignition Documentation ) nor for Power Table documentation (Vision - Power Table - Ignition User Manual 8.0 - Ignition Documentation) and also search function (Search - Ignition Documentation) does not give a result about this. Is there any other documentation I am missing?

found a solution for column width:

1 Like

You are correct - .getColumnWidth() method does not exist on the table component itself. It’s surprising to me that if a .set exists, that a corresponding .get doesn’t also exist at the same level. But, as you found, you can drill down a couple of layers into the column model and get the width of individual columns.
I have used setColumnWidth previously, so my bad on the assumption that its counterpart existed.

As far as inspecting a component (or any other python object) to see what methods exist, I use the dir(object) method.

myTable = <path to table component>
for item in dir(myTable):
	if item.startswith('get'):
		print item

I use this in a button actionPerformed event handler to inspect components on test screens. You can do this iteratively to find things you are looking for that may not be documented.

Another tool is the introspect script that @pturmel wrote: Finding all available methods from a component

I’ve used that a bunch of times to inspect objects and then using that information to cross reference the SDK documents to look further.

1 Like

Thank you for pointing that out. Good to know that there are methods to find all existing methods for objects, that might be very helpful in my future Ignition projects.