I want a DataField that can present a variety of different data values, with a settings page to choose which one.
One way to do this would be to have a member identifying which field via an enum, and switch on the enum to extract the value. But it seems like you should be able to just store the symbol for the field. Something like:
class MyView extends WatchUi.DataField {hidden var mInfoField as Symbol = :currentSpeed; // for example function computeValue(info as Activity.Info) as Void { if (info has mInfoField) { var field = info[mInfoField]; // <-- warning is here if (field != null) { var value = field.toFloat();...}}}...}WARNING: fenix5xplus: MyView.mc:31: Cannot determine if container access is using container type.info has mInfoField), but then not be able to get its value (without raising a warning at compile time). For methods, there's the explicit method(m) to do this, but I can't find a corresponding way to fetch a value given its symbol.