XSI的控件创建方式
var oPSet = ActiveSceneRoot.AddProperty( "CustomProperty", false, "ButtonExample" ) ;
oPSet.AddParameter3( "SomeText", siString ) ;
var oLayout = oPSet.PPGLayout
oLayout.AddRow() ;
oLayout.AddItem( "SomeText" ) ;
var oItem = oLayout.AddButton( "ClickMe", "Click Me" ) ;
oItem.SetAttribute( "buttondisable", true ) ;
oLayout.EndRow() ;
oLayout.Logic = SomeText_OnChanged.toString() + ClickMe_OnClicked.toString() ;
oLayout.Language = "JScript" ;
InspectObj( oPSet ) ;
function SomeText_OnChanged()
{
bDisableButton = ( PPG.SomeText.Value.length == 0 ) ;
oPPGLayout = PPG.PPGLayout ;
oPPGItem = oPPGLayout.Item( "ClickMe" ) ;
bAlreadyDisabled = oPPGItem.GetAttribute( "buttondisable" ) ;
if ( bDisableButton != bAlreadyDisabled )
{
oPPGItem.SetAttribute( "buttondisable", bDisableButton ) ;
PPG.Refresh() ;
}
}
function ClickMe_OnClicked()
{
XSIUIToolkit.MsgBox( "Value of text is " + PPG.SomeText.Value ) ;
}