If you have an enum which is used in more than one place, and at one of the places you need to hide one of the elements?
Asked
Active
Viewed 5,137 times
1
-
Technically a duplicate of: http://stackoverflow.com/questions/7441422/how-to-hide-enum-values-on-a-combo-box-at-runtime – Jan B. Kjeldsen Feb 02 '15 at 10:41
2 Answers
1
Hiding enum elements on runtime ax 2012
1.Override enter() on created ComboBox and write this code:
this.delete(enum2str(EnumType::Element1)); super();
Now run form and check. Element1 is the element which you need to hide.
This worked for me.
-
This only works when the enum values that you want to remove are the last values. Otherwise the value no longer matches the selection. Example enum [0=A, 1=B, 2=C]. Deleting the last value 'C' will leave [0=A, 1=B], which is correct. Deleting 'A' will result in [0=B, 1=C] ==> the integer values no longer match the original enum. – Sander Jul 19 '16 at 07:56
1
Also consider using SysFormEnumComboBox.
The SysFormEnumComboBox class facilitates work with a form combo box control, representing an enumeration when only some of the enumeration values are allowed.
See this blog post for an example.

Jan B. Kjeldsen
- 17,817
- 5
- 32
- 50