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 ) )
# Set the diagonal as read-only
ROcells = [ 0,0, 1,1, 2,2 ]
gridData.SetCellReadOnlyFlags( ROcells, True )
Application.InspectObj( siProperty )
# Now log the read-only flags for row == 1
Application.LogMessage("Read-only flags for row 1 = %s"%str(gridData.GetCellReadOnlyFlags( [ 0,1, 1,1, 2,1 ] ) ) )
# Expected result:
# INFO : Read-only flags for row 1 = (0, -1, 0)
|