jeudi 3 mars 2016

How to add CheckBoxes to a ComboBox?

I want to create a ComboBox having Checkboxes as children using Codename one.

I am not using the UIBuilder

For reusability I created a Container having three Checkboxes in it:

OverviewCheckBoxContainer
 - Checkbox1
 - Checkbox2
 - Checkbox3

and this works already.

As it takes too much space on the screen, I now tried to add the CheckBoxContainer into a Combobox, like this:

ComboBox
 - OverviewCheckBoxCont
    -...

but it does not work, the ComboBox contains a single entry only and it's not a checkbox, but a text:

OverviewCheckBoxCont[x=...

(cannot see further on the screen)

How can I solve this issue, so there is a dropdown menu containing the three Checkboxes, that toggle onClick?

ps:

In the main form I added the CheckBoxesComboBox instead of the CheckBoxesCont:

 this.add(BorderLayout.CENTER, checkBoxesComboBox)

instead of

 this.add(BorderLayout.CENTER, checkBoxesCont)




Aucun commentaire:

Enregistrer un commentaire