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

[FEATURE] CheckBox as multichoice with similarity to RadioGroup #763

Open
michalfita opened this issue Oct 9, 2023 · 2 comments
Open

[FEATURE] CheckBox as multichoice with similarity to RadioGroup #763

michalfita opened this issue Oct 9, 2023 · 2 comments

Comments

@michalfita
Copy link

michalfita commented Oct 9, 2023

Is your feature request related to a problem? Please describe.
Looks like the CheckBox is not a popular widget. I found it bizarre that contrary to radio box it's not linked with it's label (I have to make LinearLayout with TextView on the right, but then highlighting for selection work only over check boxes, not the whole line.

On top of that would be nice to have some kind of MultichoiceGroup control, returning HashSet<T> or HashSet<Rc<T>> with selections.

Describe the solution you'd like

  • Ability to visually link a checkbox with it's label for nicer highlight on focus.
  • Grouping feature to manage multi-choice as single widget with result (higher level of abstraction).
  • Ability to skip disabled items when cursor is moved like RadioGroup does.

Describe alternatives you've considered
I brutally encoded bunch of CheckBoxes with TextViews linked by horizontal LinearLayout, but it's not visually appealing on focus. Then I'd have to handle evens individually to maintain a state of possible selections.

Additional context
image

I'm willing to provide PR if API of CheckBox::new() can be aligned with RadioBox::new(), or a new builder ::labelled() can be introduced and we let both widgets be created w/o attached label, so RadioBox::new() looses the argument and label member becomes Optional<StyledString>.

michalfita added a commit to michalfita/cursive that referenced this issue Oct 25, 2023
michalfita added a commit to michalfita/cursive that referenced this issue Oct 25, 2023
michalfita added a commit to michalfita/cursive that referenced this issue Oct 25, 2023
@gyscos
Copy link
Owner

gyscos commented Feb 8, 2024

Hi, and thanks for the report!

Indeed, it would be nice to unify the radio and check boxes.
I'm not against adding a label to the Checkbox to match what Radiobox has, but I'm wondering if we could be more general, and make it easier to attach an arbitrary TextView (or anything else really) and have a nice highlighting over both. This way, we wouldn't have to support left vs right, various padding, ...

@michalfita
Copy link
Author

I don't mind. This, however, would breaking change.

The advantage of current one is much simpler creation. I did my PR trying to not break things, and this is working for me. At the moment I don't have capacity to do anything above that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants