GridWidget.GetSelection
 
 
 

GridWidget.GetSelection

Introduced

v12.0 (2014)

Description

Gets the current selection.

C# Syntax

Object GridWidget.GetSelection();

Scripting Syntax

oReturn = GridWidget.GetSelection();

Return Value

Array of column/row indices referring to selected cells in the grid widget.

Examples

Python Example

import win32com.client
from win32com.client import constants as C
propName = "TheProperty"
gridDataName = "TheGrid"
siProperty = Application.ActiveSceneRoot.AddProperty( "CustomProperty", False, propName ) 
gridData = siProperty.AddGridParameter(gridDataName).Value 
gridData.ColumnCount = 3
gridData.RowCount = 3
for row in range( 3 ):
        gridData.SetRowLabel( row, "Row %d"%row )
        for col in range ( 3 ):
                if row == 1:
                        gridData.SetColumnLabel( col, "Col %d"%col )
                gridData.SetCell( col, row, "%d,%d"%( col, row ) )
Application.InspectObj( siProperty )
# Give some time for the PPG to get displayed, otherwise the grid widget 
# will not be accessible
Application.Desktop.RedrawUI()
# Retrieve the widget
widget = gridData.GridWidget
# Select the diagonal
widget.AddToSelection( 2, 2 )
widget.AddToSelection( 0, 0 )
widget.AddToSelection( 1, 1 )
# Log the current selection
Application.LogMessage( "Current selection = %s"%str( widget.GetSelection() ) )
# Expected result:
# INFO : Current selection = (0, 0, 1, 1, 2, 2)