XSIFactory.CreateGridParamDef
 
 
 

XSIFactory.CreateGridParamDef

Introduced

v5.0

Description

Creates a GridData parameter definition for use with a CustomProperty or CustomOperator. The grid is a convenient way to store 1- or 2-dimensional Arrays and the user can view and edit this data via the siControlGrid (see siPPGControlType constant).

To change the contents of the grid via scripting use the GridData object, which is accessible via Parameter.Value.

To include the GridData in the property page of the CustomProperty or CustomOperator use PPGLayout.AddItem.

C# Syntax

ParamDef XSIFactory.CreateGridParamDef( String in_ScriptName );

Scripting Syntax

oReturn = XSIFactory.CreateGridParamDef( ScriptName );

Return Value

ParamDef

Parameters

Parameter Type Description
ScriptName String This argument specifies the ScriptName of a parameter (see Parameter.ScriptName). This name is also used as the name and description.

Examples

JScript Example

/*
        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 );

See Also

CustomOperator.AddParameter CustomProperty.AddParameterFromDef GridData