LookupField uses wrong index for enums

Hello there,
I am having a problem when selecting enums inside a LookupField, which is wrapped in a FieldGroup.
I have around 20 enum values defined, however, Cuba does only accept the first 10 entries.
When I select the 11th entry, it selects the first entry.
When I attach a ValueChangedListener like this:

lookupField.addValueChangeListener(new ValueChangeListener() {
            public void valueChanged(ValueChangeEvent e) {
                showMessageDialog("Value difference", e.getPrevValue() + " and new: " + e.getValue(), MessageType.CONFIRMATION);

it correctly identifies the previous value but the new value is already the wrong one.
I have an enumeration of countries:

  1. Germany
  2. US
  3. UK
  4. Austria
  5. Switzerland
  6. Denmark
  7. Poland
  8. Estonia
  9. Latvia
  10. Finland
  11. Norway

I select the 10th entry, which is Finland, and then select the 11th entry (Norway) the message reads as: “FINLAND an new: GERMANY” (Germany is the 1st entry in the list).

I wasn’t able to find any method which overrides the default behaviour for selecting the index, is there any?
How do I work around this?


Which version of the platform do you use in you project?

I have tried to reproduce the problem as described, but the application works well (shows “TEN and new: ELEVEN”).

Could you create a little project in which the problem occurs and share it here? The project can be easily archived by calling the zipProject gradle task.


thanks for your quick reply.
When I create a new project (tested with v6.2.7 and v6.2.8) I am also unable to reproduce the problem, it works as intended.

Since the project was running on v6.2.7 I upgraded to 6.2.8, but that didn’t change anything.
So it might be an issue with my project configuration I guess…

Solved the issue: I had given the enums the same values, causing this effect.
I must say, quite a dumb error. :confused:

Anyway, thanks for your time!

We’ll add validation of ids to Sudio, thanks for the hint!

Well, I’m looking forward to that check. Thanks!


In Studio from version 6.3.2 creation of enums with the same ID is not permitted.

1 Like