Interactive Dropdown for VariableParameterComponent

I’m working on a VariableParamiterComponent in C# I’m trying to set it up so that when a user selects the + symbol to add a parameter they get a dropdown list of parameter types to add. Currently I have the dropdown list working and am able to add parameters, but it seems that the user selection doesn’t update properly. For example the first time the user selects a dropdown option nothing happens. The second time they select from the dropdown the component updates with there selection from the first pass and so on. Third executes second forth executes third… I’m new to programing and suspect that I’m missing something simple but have just been spinning my wheels for days now. Thanks in advance for any help.


seventeen.cs (3.3 KB)

Hello,

Throwing this in step by step mode, it appears that the dropdownMenue() does not wait for an option to be selected, it exits immediately. Therefore, the CreateParameter() method immediately continues, the first time, having a null entry, so nothing happens.
Then the option is selected, so the string selectedOption is set. However the ExpireSolution() only triggers a component solution, not a param update.
So what happens next is that when you click again on +, the same process repeats but this time, selectedOption is not null, so a parameter is created.

I moved the parameter creation inside the event method, using the RegisterInputParam() method.

I also added a private inputIndex variable, so that the parameter is inserted at the correct location.

seventeen.cs (3.7 KB)

@magicteddy This is perfect!! thankyou so much.