GridData.SetColumnType operator

導入

v4.0

詳細

特定の列に使用するコントロールのタイプを指定します。デフォルトの列タイプ siColumnStandard は文字列や番号などのほとんどのデータに最適なため、このメソッドはオプションです。

C#構文

GridData.SetColumnType( Int32 in_lColumnIndex, siGridWidgetColumnType in_Type );

スクリプト構文

GridData.SetColumnType( ColumnIndex, Type );

パラメータ

パラメータ タイプ 説明
ColumnIndex long 列のインデックス。一番左の列のインデックスが 0 になります。
Type siGridWidgetColumnType 列のタイプ

JScript の例

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

//insert a row at index 5 GridData has 51 rows now!

oGridData.InsertRow( 5 ) ;

InspectObj( oPSet ) ;

関連項目

GridData.GetColumnType GridData.SetColumnComboItems