What is the best pattern for having a select all or deselect all checkboxes. Can someone come up with a better way to have it in this form:
-
related ux.stackexchange.com/questions/21415/…– Adrien BeJun 12, 2014 at 15:16
-
related ux.stackexchange.com/questions/1382/…– Adrien BeJun 12, 2014 at 15:17
5 Answers
I'll be honest, I've never liked the idea of using a checkbox for the "select all" option, even though you see it a lot. It's not a single item to be picked, it's an action. And if you select all and then start unselecting individual items in the list, the "checked" state of the select all checkbox becomes inherently confusing. I prefer to use a simple but obvious link/button that toggles between "select all" and "unselect all" as it is clicked. There is no state to confuse you with when individual items have been deselected, and the outcome of pushing the button is never in doubt. The exclusive nature of the operation makes it perfectly reasonable to toggle back and forth (rather than using two always visible buttons; one for select all, one for unselect all), since you are at most two clicks away from your desired behavior. And it visually separates out this "action" from the individual items, preventing misclicks and distinguishing behavior.
-
-
This answer provides some code to implement this idea in WinForms: stackoverflow.com/a/35616240/848199 Feb 25, 2016 at 0:56
If you can format your dialog with lists, I like the "checkbox in the list header" method (and most users intutively know how to use it).
If you do not want to use a list, I think a button or a hyperlink (that toggles from "Select All" to "Select None" would work better than yet another checkbox which is hard to make out among all the other checkboxes. Also, unchecking a "check all" checkbox would not necessarily immply a "check none" functionality for a user.
Just bring the Select All check box closer to the left border. Perhaps change the text something like "All previous games" etc. to make it clear what "all" is being selected.
Here's the logic for a User Control in WinForms to implement @nezroy's answer. This lets you specify an InitialAction [one of SelectAll or DeselectAll] as well.
Imports System.ComponentModel
''' <summary>
''' A control which allows the user to toggle back-and-forth
''' between selecting all of something, or de-selecting all of something.
''' </summary>
Public Class uscSelectDeselectAll
#Region "Events"
Public Event CurrentAction_Changed()
#End Region
#Region "Enums"
Public Enum SelectAction
SelectAll
DeselectAll
End Enum
#End Region
#Region "Module-level variables"
Private _initialAction As SelectAction
Private _currentAction As SelectAction
#End Region
#Region "Properties"
Public Property CurrentAction As SelectAction
Get
Return _currentAction
End Get
Private Set(value As SelectAction)
_currentAction = value
SetActionLinkText()
End Set
End Property
<Browsable(True)>
<EditorBrowsable(EditorBrowsableState.Always)>
<DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)>
Public Property InitialAction As SelectAction
Get
Return _initialAction
End Get
Set(value As SelectAction)
_initialAction = value
SetActionLinkText()
End Set
End Property
#End Region
#Region "Procedures"
Private Sub SetActionLinkText()
If _currentAction = SelectAction.SelectAll Then
llActionText.Text = "Select All"
ElseIf _currentAction = SelectAction.DeselectAll Then
llActionText.Text = "Deselect All"
Else
Throw New InvalidEnumArgumentException("Invalid SelectActionProvided.")
End If
End Sub
Private Sub ToggleAction()
If CurrentAction = SelectAction.SelectAll Then
CurrentAction = SelectAction.DeselectAll
ElseIf CurrentAction = SelectAction.DeselectAll Then
CurrentAction = SelectAction.SelectAll
Else
Throw New Exception("CurrentAction has the invalid value: " & CurrentAction.ToString())
End If
End Sub
#End Region
#Region "Event Handlers"
Private Sub llActionText_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles llActionText.LinkClicked
RaiseEvent CurrentAction_Changed()
ToggleAction()
End Sub
Private Sub uscSelectDeselectAll_Load(sender As Object, e As EventArgs) Handles Me.Load
CurrentAction = InitialAction
End Sub
#End Region
End Class
I would say that It's the most intuitive way to make the select/deselect all. But I've also seen some use a link, but i would prefer that.
-
having a checkbutton that performs an action rather than designate a discrete choice isn't very usable IMO. Feb 6, 2009 at 22:29