<div dir="ltr">We already have ToggleButton:<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Unlike RadioButtons, ToggleButtons in a ToggleGroup do not attempt to force at least one selected ToggleButton in the group.</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">That is, if a ToggleButton is selected, clicking on it will cause it to become unselected. </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">With RadioButton, clicking on the selected button in the group will have no effect.</blockquote><div><br></div><div>Checkboxes tend to allow multiple selection ("select all items that apply to you"), which means they don't need to toggle each other, they are independent. They also have indeterminate states, which I don't know how to address regarding ToggleGroup selection policies.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 21, 2023 at 6:33 PM Michael Strauß <<a href="mailto:michaelstrau2@gmail.com">michaelstrau2@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">My expectation with radio groups is that they may start out initially<br>
unselected, but once a selection has been made, no user interaction<br>
can unselect all toggles again.<br>
I don't see any compelling reason to change that. If the group needs<br>
to be reset to its initial state, that's as easy as calling<br>
`toggleGroup.selectToggle(null)`.<br>
<br>
However, what you're describing sounds to me like a group of<br>
checkboxes. I've seen this type of grouping many times in various<br>
applications, and checkboxes are generally understood to be<br>
deselectable.<br>
So my question is: why don't we instead have CheckBox implement<br>
Toggle, allowing it to be used with ToggleGroup? That would make it<br>
possible to create a deselectable group of toggles.<br>
<br>
On Fri, Jan 20, 2023 at 8:31 PM Andy Goryachev<br>
<<a href="mailto:andy.goryachev@oracle.com" target="_blank">andy.goryachev@oracle.com</a>> wrote:<br>
><br>
> Dear colleagues:<br>
><br>
><br>
><br>
> In the context of a recent PR<br>
><br>
><br>
><br>
> <a href="https://bugs.openjdk.org/browse/JDK-8237505" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-8237505</a><br>
><br>
> <a href="https://github.com/openjdk/jfx/pull/1002" rel="noreferrer" target="_blank">https://github.com/openjdk/jfx/pull/1002</a><br>
><br>
> <a href="https://stackoverflow.com/questions/57911107/javafx-togglegroup-not-functioning-properly-with-accelerators-radiomenuitem" rel="noreferrer" target="_blank">https://stackoverflow.com/questions/57911107/javafx-togglegroup-not-functioning-properly-with-accelerators-radiomenuitem</a><br>
><br>
><br>
><br>
> where a number of RadioMenuItems belonging to a toggle group are added to the menu, we might want to add a new property to the ToggleGroup which controls whether all items in a group can be deselected.<br>
><br>
><br>
><br>
> If this property is set, a selected radio menu item can be deselected via either keyboard accelerator or a mouse click.  If not, then not only this operation cannot be performed, but also the first item added to said ToggleGroup gets automatically selected.<br>
><br>
><br>
><br>
> This should allow for more flexibility in creating menus with RadioMenuItems, but eliminate some boilerplate code required in such cases.<br>
><br>
><br>
><br>
> The new logic would also affect any Toggle, such as ToggleButton.<br>
><br>
><br>
><br>
> What do you think?  Thank you.<br>
><br>
><br>
><br>
> -andy<br>
</blockquote></div>