Suppose the combobox is linked to enum "ABC". The elements in it are A, B C and D.
Now I need to get only A and C in the combobox and not B and D?
Is this possible?
However, while binding a combobox with enum, one can face a common problem that enum values are not user-friendly for display. So here, we will learn a way to show user-friendly enum names to end users. Please note that here, I have considered the implementation mentioned in the previous article, so please check that first before going further.
To assign an enum to another incompatible enum, just add zero to it! Or you can update your combobox using programming (using a combobox without specifying an enum type): See also Enum as a Parameter in Dynamics AX about adding new values to a combobox.
In my previous article, we learned how to bind a combobox directly with the enum. However, while binding a combobox with enum, one can face a common problem that enum values are not user-friendly for display. So here, we will learn a way to show user-friendly enum names to end users.
See also Enum as a Parameter in Dynamics AX about adding new values to a combobox. While it is not possible do delete enum values at runtime, it is possible to hide enum values for the entire application. Just change the enum value's ConfiguratioKey to "SysDeletedObjects40", and it disappears as a legal value.
Easy, create a run method in your form and put this:
public void run()
{
super();
YourCombo.delete(enum2str(YourEnum::B));
YourCombo.delete(enum2str(YourEnum::D));
}
Regards
It is not possible to delete enum values or combobox values.
You can duplicate the enum, then delete elements or change the order (but not the enum value). It will be your responsability to maintain both enum types synchronized with future changes.
To assign an enum to another incompatible enum, just add zero to it!
abc = myAbc + 0;
Or you can update your combobox using programming (using a combobox without specifying an enum type):
YourComboBox.add("A");
YourComboBox.add("C");
See also Enum as a Parameter in Dynamics AX about adding new values to a combobox.
While it is not possible do delete enum values at runtime, it is possible to hide enum values for the entire application. Just change the enum value's ConfiguratioKey to "SysDeletedObjects40", and it disappears as a legal value. I will assume that this configuration key is not enabled!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With