GridWidget.GetSelection

導入

v12.0 (2014)

説明

現在の選択を取得します。

C#構文

Object GridWidget.GetSelection();

スクリプト構文

oReturn = GridWidget.GetSelection();

戻り値

グリッドのウィジェットで選択されたセルを参照する列/行インデックスの配列。

Python の例

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)