Enumeration value in Widget definition XML

I'm currently working on a widget that uses the enumeration of an object attribute. I want to match the current value on certain values, that are configured in the modeler. The widget XML allows me to select the attributes with an enumeration, so that is fine. However, if I want to supply enumeration values for this enumeration, it is not possible. Now I just enter the keys as string value, but that does not involve a consistency check on a change of the enumeration itself. Is this possible?
2 answers

I don't think this is possible by default. Perhaps you could work around it by using a constraint attribute type. As this will allow you to type in xpath. In Xpath you are able to access the enumeration values.


Ther are 2 types of enumerations

1) Mendix entity attribute of the type enumeration.

In your widget you can access the details via the MetaObject


var mxmetaobject = mx.meta.getEntity("MyFirstModule.Paint");

mxmetaobject.getEnumKVPairs("Color"); // { red: "Red",
                                      //   green: "Green",
                                      //   blue: "Blue" }

or directly through the mx object


mxobject.getOptions("Color"); // [ "red", "green", "blue" ]


2) Widget attributes, options to configure inside your widget.

<property key="colorEnum" type="enumeration" defaultValue="xff0000">
  <description>The textcolor of the message in the widget</description>
    <enumerationValue key="xff0000">Red</enumerationValue>
    <enumerationValue key="x000000">Black</enumerationValue>
    <enumerationValue key="xffffff">White</enumerationValue>