Why LWUIT ComboBox's blank item is not selectable?

363 views Asked by At

I created a ComboBox of String[] :

genretxt=new ComboBox(new String[]{"Féminin","Masculin"});

The problem is that the popup has a blank item when clicking the ComboBox at runtime , but this blank item is not clickable : even though I click it then the selection remains at the previous selection.

I tried to add the "" String to the array argument of the ComboBox : genretxt = new ComboBox(new String[]{"","Féminin","Masculin"}); but in runtime there is two blank items , so it is not very good to see !

Also the genretxt component's value is not mandatory in my application so the user can select null in the ComboBox.

I tried to derive the ComboBox class and implemented the createPopupList() method but the problem is the same !

So how to make it possible to select a null item in the ComboBox ?

1

There are 1 answers

1
Shai Almog On BEST ANSWER

I'm not exactly sure where you see that blank and without an exact way to reproduce, version of LWUIT & theme used there isn't much I can help with there.

In order to allow selecting a blank you need to actually add it to the combo box, there is no way around it. LWUIT has a special case for empty strings where they occupy 0 space. You can resolve it either by having a string like [None] or by calling setRenderingPrototype("XXXXXXXX") or by creating your own renderer.