Enumerator in Class of View

I have a class, e.g. “myClass”, which has an enumeration, e.g. “myEnumeration”. The enumeration scope is set to Public. I can refer to the enumeration in class methods however when I make the class a Property of a View and attempt to refer to the enumeration, Xojo reports that “Type ‘myClass’ has no member named ‘myEnumeration’”.

I read somewhere that a solution to this is to put the enumeration into a module but that doesn’t seem to be the right place for it? Is there a trick to this that I am unaware of?

This seems to work fine in my simple test. What does your code look like?

To refer to the enum, you need to use the class name, not the property name.

Actually I realise I left one thing out. The class “myClass” isn’t a regular property of the View, it is a computed property (i.e. with Get and Set methods and a local copy). Might that be the cause?

I have found that if I rename the computed property of the View from “myClass” to “myClassView”, also of type “myClass”, then the enumerator is now accessible within the View.

If you have both the class and property with the same name, then you are likely running into a scoping problem. The local scope (the property) is taking precedence over the global scope (the class name).

Try prefixing the Global keyword in front.

Global.myClass.myEnumeration

That fixed it. Thanks Paul!