Enumerations editor - is this a bug?

Enumerations should only be integers. According to the documentation:

Enumerations are always an Integer type and default to “Integer”. You can change the type to other Integer types (such as UInt64) should you need to use larger values for the enumeration elements.

But the autocomplete in Type, in the Enumerations Editor, lets you select String.

Of course, as soon as you tab out of the field, it reverts to Integer:

I would expect that the autocomplete would only display items that are allowed in that field, whatever the field may be.

1 Like

If enumerations are only integers (which I also think), why putting an editable field at all?

@Perry_Paolantonio , what are the Xojo version and OS version ?

Thanks

you need to be able to use different types of integer like Uint64 etc (for declares etc)

2 Likes

Well the documentation says you can specify the type of integer if you need (see my quoted text from the docs above), so it does make sense that autocomplete is there, it just doesn’t make sense to me that it would let you choose illegal types.

Xojo 2022r2 on Mac OS Big Sur 11.6.1

Perhaps a popup menu would be more suitable? On the other hand, if all other fields are text fields, it’s arguable. :man_shrugging:

The issue isn’t the mechanism by which you select the options, it’s that incorrect options appear to be there. The same thing could happen in a popup, if the wrong data is supplied to that control…

I’ve opened an issue about this since it just doesn’t seem right: 70140

I think it was said that autocomplete is not “smart enough” to work whatever the user expects and is more like a help for the user to complete what they started to type, so following that it makes sense that autocomplete works this way there.

For example, this doesn’t make sense too but autocomplete works the same:
image

Maybe change Type to popup as Arnaud said.

1 Like

Then make it so wrong data aren’t supplied to it.
As Alberto says, autocomplete isn’t made like a popup menu. A popup menu holds a list of choices, while autocomplete will usually contain all minus what’s not in the current context.

Understood. Though the autocomplete options are context-sensitive in other parts of the IDE so it seems reasonable to expect the same here:

And that is different that just typing Str… and press TAB. In this example the autocomplete knows that root is XmlNode because you typed root. then TAB.

Yes, they can disable the autocomplete for Type, create a limited version of autocomplete that only allows Integer, Uint64, Int32, etc., or change to popup.

1 Like