CheckComboBox ListChangeListener fires off twice after selection change

Issue #839 new
Alex M
created an issue

I'm using a custom ControlsFX that has Pull Request #677 which adds the ability to click on the label next to the checkbox in order to select the item.

After some testing, I believe it comes down to the changes made in this pull request, and I'll explain why.

Here's what my test code looks like:

checkComboBox.getCheckModel().getCheckedItems().addListener(new ListChangeListener<String>() {
    @Override
    public void onChanged(ListChangeListener.Change<? extends String> c) {
        while (c.next()){
            System.out.println("test");
        }
    }
});       

After a few hours of testing, I found out that if I click directly on the checkbox, it only fires off once. But if I click on the label to the right of the checkbox, it fires off twice.

I also created a separate project with the publicly available ControlsFX and tried it out. It works properly (which, considering my previous testing, it should work properly because the label on the right cannot be clicked in order to select the checkbox).

Put it all together, and I think the culprit lies somewhere in the changes made in Pull Request #677.

Happy Holidays and take care, everyone!

Comments (2)

  1. Stefano Negri

    Hello and thank you for reporting this issue. I have had a look into it and in the end I created PR 684. I am going to add some comments to the pull request because some aspects of the implementation are not entirely clear to me and this issue might be revealing other problems.

  2. Log in to comment