Hello, I have an unbound control named ElementType
The original control have 7 values inside but i have created a new dialog and on this dialog, according the selected record I fill the enum with different values everytime.
public void init()
{
ElementTable selectedRecord = this.args().record();
Set enumSet = new Set(Types::Enum);
switch (selectedRecord.ElementType)
{
case ElementType::Object:
case ElementType::Milestone:
enumSet.add(ElementType::Task);
enumSet.add(ElementType::Milestone);
break;
case ElementType::Task:
enumSet.add(ElementType::Task);
enumSet.add(ElementType::Milestone);
enumSet.add(ElementType::Line);
break;
default:
break;
}
sysFormEnumComboBox::newParameters(element,element.controlId(formControlStr(ElementTypeSelectionDialog,ElementType)),enumNum(ElementType),enumSet, "@Test:ElementType");
super();
}It works fine but now i want to retrive this value in CloseOk. The problem is that when I am using any2enum(ElementType.selection() it return the value of the original enum.
For example as you see I add three values (Task, Line, Milestone). But when I try to get the value with the above line it return the index of the first value of the enum that is not declared in the set.
I tried to do it by comparing the selection with specific values (0,1,2) but the problem there is that the set is dynamic and everytime the set can be filled with different values. So that does not make sense.
Do you have anything in mind that can solve this issue?