/*
This example illustrates how to create a grid parameter from a parameter definition.
*/
var o = Application.ActiveSceneRoot.AddCustomProperty( "MagicIdentity ");
var param = o.AddParameterFromDef( XSIFactory.CreateGridParamDef("magicI") );
// Set data on grid
var grid = param.value;
grid.RowCount = 180+1;
grid.ColumnCount = 4;
for ( var i = 0; i <= 180; i++ )
{
var magicI = Math.pow( Math.cos(i), 2 ) + Math.pow( Math.sin(i), 2 );
grid.SetRowValues( i, Array(i, Math.cos(i), Math.sin(i), magicI) );
}
// Set column labels
grid.SetColumnLabel( 0, "@" ) ;
grid.SetColumnLabel( 1, "cos(@)" ) ;
grid.SetColumnLabel( 2, "sin(@)" ) ;
grid.SetColumnLabel( 3, "sqr(cos(@) + sqr(sin(@)" ) ;
// Set layout attributes
var oLayout = o.PPGLayout;
var oPPGItem = oLayout.AddItem( "magicI", "",siControlGrid) ;
oPPGItem.SetAttribute( "NoLabel", true ) ;
oPPGItem.SetAttribute( siUIGridLockColumnHeader, true );
oPPGItem.SetAttribute( siUIGridHideRowHeader, true );
|