AGI AgAttrAutomation 11 Send comments on this topic.
AddChoicesDispatchProperty Method (IAgAttrBuilder)
See Also  Example
DispScope
The attribute container (scope) where the attribute will be added.
Name
Name of the attribute to add.
Description
Description of the attribute to add.
PropName
Name of the property to be called to set/get the value of this attribute. The property must be of the same type as that of the values in the array.
Choices
Choices is a SAFEARRAY of variants that provides a selection combo box in the configuration user interface.





Description

Add an Attribute that provides a combobox of values from which the user can choose.

Syntax

[Visual Basic .NET]
Public Sub AddChoicesDispatchProperty( _
   ByVal DispScope As Object, _
   ByVal Name As String, _
   ByVal Description As String, _
   ByVal PropName As String, _
   ByVal Choices As System.Array _
) 

[C#]
public void AddChoicesDispatchProperty(
Object DispScope,
string Name,
string Description,
string PropName,
System.Array Choices
);

[Managed C++]
public: void AddChoicesDispatchProperty(
IUnknown ^ DispScope,
String __gc ^ Name,
String __gc ^ Description,
String __gc ^ PropName,
System::Array ^ Choices
);

[Java]
public  addChoicesDispatchProperty(
Object DispScope,
String Name,
String Description,
String PropName,
Object[] Choices
);

[Unmanaged C++]
public: HRESULT AddChoicesDispatchProperty(
IUnknown * DispScope,
BSTR Name,
BSTR Description,
BSTR PropName,
SAFEARRAY * Choices
);

Parameters

DispScope
The attribute container (scope) where the attribute will be added.
Name
Name of the attribute to add.
Description
Description of the attribute to add.
PropName
Name of the property to be called to set/get the value of this attribute. The property must be of the same type as that of the values in the array.
Choices
Choices is a SAFEARRAY of variants that provides a selection combo box in the configuration user interface.

Example

Add an Attribute that provides a combobox of values from which the user can choose.
[C#] Copy Code
//Add the following code to your plugin 
public object Choice { get; set; } 
public object[] Choices = new object[4] { "0""1""2""3" }; 
 
 
public object GetPluginConfig(AGI.Attr.AgAttrBuilder pAttrBuilder) 

    if (m_AgAttrScope == null
    { 
        m_AgAttrScope = pAttrBuilder.NewScope(); 
        pAttrBuilder.AddChoicesDispatchProperty(m_AgAttrScope, "Choice""A property""Choice", Choices); 
    } 
 
    return m_AgAttrScope; 

 

Add an Attribute that provides a combobox of values from which the user can choose.
[Visual Basic .NET] Copy Code
'Add the following code to your plugin
Public _choice As Object
Public Property Choice() As Object Implements IExample1.Choice
    Get
        Return _choice
    End Get
    Set(ByVal value As Object)
        _choice = value
    End Set
End Property
Public Choices() As Object = New Object(3) {"0", "1", "2", "3"}


Public Function GetPluginConfig(ByVal pAttrBuilder As AGI.Attr.AgAttrBuilder) As Object Implements IAgUtPluginConfig.GetPluginConfig
    If m_AgAttrScope = Nothing Then
        m_AgAttrScope = pAttrBuilder.NewScope()
        pAttrBuilder.AddChoicesDispatchProperty(m_AgAttrScope, "Choice", "A property", "Choice", Choices)
    End If

    Return m_AgAttrScope
End Function

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1