PPGLayout.AddEnumControl
 
 
 

PPGLayout.AddEnumControl operator

Introduced

v4.0

Description

This method is similar to PPGLayout.AddItem except it makes it easy to specify enumeration style controls like siControlCombo, siControlRadio, siControlListBox and siControlIconList. These are controls which restrict the values that a users can set on a parameter by offering a specific list of valid values. Any numeric or string Parameter type can be driven by these controls.

C# Syntax

PPGItem PPGLayout.AddEnumControl( String in_ParamName, Object in_UIItemsArray, String in_opt_Label, String in_opt_UIType );

Scripting Syntax

oReturn = PPGLayout.AddEnumControl( ParamName, UIItemsArray, [Label], [UIType] );

Return Value

PPGItem

Parameters

Parameter Type Description
ParamName String Scripting name of the Parameter. The call does not fail even if no parameter by this name exists. However in that case the control is not drawn as part of the layout.
UIItemsArray Array of Variants A 1-dimensional array of Label/Value pairs. Each label is a string and the value is a variant whose type should match the Parameter.ValueType of the associated parameter. For example, for a bitfield, the array might be Array( "Bit 0", 1, "Bit 1", 2, "Bit 2", 4 ).
Label String Most controls have a label, for example the text that appears to the left of a numeric slider. If not specified here, the name of the parameter (see SIObject.Name) or Parameter.ScriptName is shown.
UIType siPPGControlType Specifies what type of control to show. Only certain controls, such as siControlCombo, siControlRadio, siControlCheck, and siControlIconList are supported.

Default Value: siControlCombo

Examples

VBScript Example

'
' This example demonstrates various Enum Controls
'
set oCustomProperty = ActiveSceneRoot.AddProperty( "CustomProperty", false, "Enum Controls" )
'Create the custom parameters, and set the default values
oCustomProperty.AddParameter3 "MyCombo", siString, "Yellow"
oCustomProperty.AddParameter3 "MyBitField", siUByte, 68
oCustomProperty.AddParameter3 "MyRadio", siInt4
oCustomProperty.AddParameter3 "NotShown", siInt4
'Define the layout
set oLayout = oCustomProperty.PPGLayout
'For the combo box we set the label and the value the same
'because we actually want to store the string the user 
'selects as the parameter value
dim aComboItems, aBitfieldItems, aRadioItems
aComboItems = Array(    "Orange", "Orange", _
                                                 "Yellow", "Yellow", _
                                                 "Apple", "Apple" )
oLayout.AddEnumControl "MyCombo", aComboItems, "Things", siControlCombo
' For a bitfields the values normally should be powers of two
' Notice they can be in any order
aBitfieldItems = Array(         "Bit 0", 1, _
                                                         "Bit 6", 64, _
                                                         "Bit 2", 4, _
                                                         "Bit 7", 128 )
oLayout.AddEnumControl "MyBitField", aBitfieldItems, , siControlCheck
' Radio button is a good alternative to ComboBox when you only
' have a few options to give to the user
aRadioItems = Array(    "Slow", 0, _
                                                 "Fast", 1 )
oLayout.AddEnumControl "MyRadio", aRadioItems, , siControlRadio
InspectObj oCustomProperty

See Also

PPGLayout.AddItem PPGItem.UIItems PPGItem.Label Parameter.ScriptName siPPGControlType XSIDialog