AGI AgAttrAutomation 6 Send comments on this topic.
AddChoicesFuncDispatchProperty 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 returned by the class property (a property declared in the scope of the plugin class).
FuncPropName
Name of a class property (a property declared in the scope of the plugin class) returning an array of choices. Used to populate the combo box choices.
Windows








Description

Add an Attribute that provides a combobox of values from which the user can choose. Similar to AddChoicesDispatchProperty but uses a callback to get the list of available values instead of a static array of strings.

Syntax

[Visual Basic .NET]
Public Sub AddChoicesFuncDispatchProperty( _
   ByVal DispScope As Object, _
   ByVal Name As String, _
   ByVal Description As String, _
   ByVal PropName As String, _
   ByVal FuncPropName As String _
) 

[C#]
public void AddChoicesFuncDispatchProperty(
Object DispScope,
string Name,
string Description,
string PropName,
string FuncPropName
);

[Managed C++]
public: void AddChoicesFuncDispatchProperty(
IUnknown ^ DispScope,
String __gc ^ Name,
String __gc ^ Description,
String __gc ^ PropName,
String __gc ^ FuncPropName
);

[Unmanaged C++]
public: HRESULT AddChoicesFuncDispatchProperty(
IUnknown * DispScope,
BSTR Name,
BSTR Description,
BSTR PropName,
BSTR FuncPropName
);

[VBScript]
'Sub object.AddChoicesFuncDispatchProperty(...)
' DispScope is type Object (an object)
' Name is type String
' Description is type String
' PropName is type String
' FuncPropName is type String
Call object.AddChoicesFuncDispatchProperty(DispScope, Name, Description, PropName, FuncPropName)

[Perl]
$objectReference->AddChoicesFuncDispatchProperty(
$DispScope, # type Object (object reference)
$Name, # type string (scalar)
$Description, # type string (scalar)
$PropName, # type string (scalar)
$FuncPropName# type string (scalar)
);

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 returned by the class property (a property declared in the scope of the plugin class).
FuncPropName
Name of a class property (a property declared in the scope of the plugin class) returning an array of choices. Used to populate the combo box choices.

Example

Add an Attribute that provides a combobox of values populated by a function from which the user can choose.
[C#] Copy Code
//Add the following code to your plugin 
public object Choice { get; set; } 
public object[] Choices 

    get 
    { 
        return new object[4] { "0""1""2""3" }; 
    } 

 
 
public object GetPluginConfig(AGI.Attr.AgAttrBuilder pAttrBuilder) 

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

 

Add an Attribute that provides a combobox of values populated by a function 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 IExample2.Choice
          Get
              Return _choice
          End Get
          Set(ByVal value As Object)
              _choice = value
          End Set
      End Property
      Public ReadOnly Property Choices() As Object() Implements IExample2.Choices
          Get
              Return New Object(3) {"0", "1", "2", "3"}
          End Get
      End Property


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

          Return m_AgAttrScope
      End Function

See Also

© 2017 Analytical Graphics, Inc. All Rights Reserved.

ODTK 6.5