Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The way CheckBoxMenuImplementation keeps track of selected items is inappropriate #140

Open
lenormf opened this issue Jul 19, 2021 · 0 comments
Labels
Bug Something isn't working

Comments

@lenormf
Copy link

lenormf commented Jul 19, 2021

Describe the bug
The CheckBoxMenuImplementation keeps track of the selected items using a map (_selected_item_dict), whose keys are the items themselves and assigned a boolean value (whether they're selected).

This causes several issues:

  • all items added to the menu are unchecked by default, but added to the map nonetheless, which duplicates data unnecessarily
  • distinct items with the same text will all share the same “selected” status as soon as one changes
  • checking/unchecking all items requires a loop (to assign True/False to every entry)

Intuitively I'd say an array containing the “element identifier” (an integer incremented at every add, or a more elaborate hash) of all items marked as selected should be used instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant