Power Table onMouseClick using selected cell

I'd like to use onMouseclick function in a power table. The idea is when I click any cell in the power table the green circle in the image will appear. Please help me. Thank you!!

What is the green circle? Is it a container or some kind of docked window?

it is a container

The propertyChange event handler would probably be more appropriate for this. The following script will do what you are wanting:

if event.propertyName == 'selectedRow' or event.propertyName == 'selectedColumn':
	container = event.source.parent.getComponent('Container') #Change this to the actual path to your container
	selectedRow = event.source.selectedRow
	selectedColumn = event.source.selectedColumn
	if selectedRow == -1 and selectedColumn == -1:
		container.visible = False
	else:
		container.visible = True

It simply checks to see which row and column is selected whenever a selection changes. If none are selected, the container looses visibility, but if something is selected, the container regains visibility.

just to add the component in the picture can be drag. I just want if the component is hidden because i drag it to the right. when i click the power table cell it will return to its original position. sorry for the insufficient info.

Is that a Perspective split container? Perhaps we are using the wrong terminology; a power table is a Vision component.

it's a vision container. yeah i'm using a power table component.

1 Like

Okay. I believe that I am seeing what you have going on there. If you add the following script to your power table's propertyChange event handler, the side panel will automatically close whenever you select a cell:

def closeSidePanel():
	seperator = event.source.parent.parent.getComponent('Left Line')
	chartPanel =  event.source.parent.parent.getComponent('Easy Chart')
	rightPanel =  event.source.parent.parent.getComponent('Pens and Axis')
	totalMovement = rightPanel.width
	system.gui.transform(seperator, (seperator.x + totalMovement), seperator.y, duration = 10)
	system.gui.transform(chartPanel, chartPanel.x, chartPanel.y, (chartPanel.width + totalMovement), duration = 10)
	system.gui.transform(rightPanel, (rightPanel.x + totalMovement), rightPanel.y, (rightPanel.width - totalMovement), duration = 10)
if event.propertyName == 'selectedRow' or event.propertyName == 'selectedColumn':
	selectedRow = event.source.selectedRow
	selectedColumn = event.source.selectedColumn
	if selectedRow != -1 or selectedColumn != -1:
		closeSidePanel()

Edit: to make this bidirectional, replace totalMovement = rightPanel.width with:

#This will make it open or close depending on the position of the panel
if rightPanel.width > 0:
	totalMovement = rightPanel.width
else:
	quarterOfChartWidth = float(chartPanel.width) * 0.25
	totalMovement = (-1) * int(quarterOfChartWidth)