How can I add options to a drop-down menu?

Options
Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 804
First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
edited June 2023 in Structures

How can I add options to a drop down menu?

Property is defined as:

        <property name="MyProp" caption="MyValues" control="select">
            <attributes options="Value 1,Value 2"/>
            <callbacks> 
            <onvalidate>OnValidateSelection</onvalidate>
        </callbacks>
        </property>
Tagged:

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 804
    First Comment First Anniversary Ansys Employee Solution Developer Community of Practice Member
    Answer ✓
    Options

    A new option “value” can be added thanks to:

        load.Properties["MyProp"].Options.Add(str(value))
    

    The list of options can be cleared with:

    load.Properties["MyProp"].Options.Clear()
    

Answers