//Demo of Grid Data with a
//Combo column and Boolean column
var oPSet = ActiveSceneRoot.AddProperty("CustomProperty",false,"GridColumnTypeDemo") ;
var oParam = oPSet.AddGridParameter( "mygrid" ) ;
var oLayout = oPSet.PPGLayout;
var oPPGItem = oLayout.AddItem( "mygrid", "", siControlGrid ) ;
oPPGItem.SetAttribute( "NoLabel", true ) ;
oPPGItem.SetAttribute( "HideColumnHeader", true ) ;
oPPGItem.SetAttribute( "ColumnWidths", "60:100:16" ) ;
var oGridData = oParam.Value
oGridData.ColumnCount = 2 ;
oGridData.RowCount = 50 ;
oGridData.SetColumnType( 0, siColumnCombo ) ;
oGridData.SetColumnComboItems( 0,
new Array( "Item 0", 0, "Item 5", 5, "Item 6", 6 ) ) ;
oGridData.SetColumnType( 1, siColumnBool ) ;
//We use the underlying value to set cell values
//in the OM, but the user will have the
//choice in a drop down between "Item 0" and "Item 5"
for ( i = 0 ; i < oGridData.RowCount ; i++ )
{
// Initialize the data
oGridData.SetCell( 0, i, 0 ) ;
oGridData.SetRowLabel( i, "Row " + i.toString() ) ;
oGridData.SetCell( 1, i, true ) ;
}
// change our mind about some
// We use the value rather than the
// combo item label
oGridData.SetCell( 0, "Row 2", 6 ) ;
oGridData.SetCell( 0, "Row 6", 5 ) ;
oGridData.SetCell( 1, "Row 1", false ) ;
//Note: It would not be valid to
//set a value that
//has no associated label in the
//Combo Items array:
//oGridData.SetCell( 0, "Row 3", 1 ) ;
InspectObj( oPSet ) ; |