最有用的全选/取消全选复选框格式

发布于 2024-07-13 11:24:05 字数 122 浏览 5 评论 0原文

全选或取消全选复选框的最佳模式是什么。 有人能想出更好的方法来以这种形式呈现它:

在此处输入图像描述

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:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

扬花落满肩 2024-07-20 11:24:05

老实说,我从来不喜欢使用复选框作为“全选”选项的想法,尽管您经常看到它。 这不是一个要选择的单个项目,而是一个动作。 如果您选择全部,然后开始取消选择列表中的各个项目,则全选复选框的“选中”状态会变得本质上令人困惑。 我更喜欢使用一个简单但明显的链接/按钮,在单击时在“全选”和“取消全选”之间切换。 当取消选择单个项目时,不会出现任何让您感到困惑的状态,并且按下按钮的结果是毫无疑问的。 该操作的排他性使其完全合理地来回切换(而不是使用两个始终可见的按钮;一个用于全选,一个用于取消全选),因为您最多只需单击两次即可实现所需的行为。 它在视觉上将该“操作”与各个项目区分开来,防止误点击并区分行为。

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.

深巷少女 2024-07-20 11:24:05

如果您可以使用列表格式化对话框,我喜欢“列表标题中的复选框”方法(大多数用户凭直觉知道如何使用它)。

SelectAllCheckBox

如果您不想使用列表,我认为可以使用按钮或一个超链接(从“全选”切换到“全选”)比另一个复选框效果更好,而另一个复选框在所有其他复选框中很难辨认。此外,取消选中“全选”复选框并不一定意味着“选中”无”用户的功能。

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).

SelectAllCheckBox

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.

春花秋月 2024-07-20 11:24:05

只需将全选复选框靠近左边框即可。 也许可以更改“所有以前的游戏”等文本,以明确选择的“所有”是什么。

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.

半步萧音过轻尘 2024-07-20 11:24:05

我想说,这是进行全选/取消全选的最直观方式。 但我也看到有些人使用链接,但我更喜欢这样。

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.

您的好友蓝忘机已上羡 2024-07-20 11:24:05

这是 WinForms 中的用户控件实现 @nezroy 答案的逻辑。 这允许您指定一个 InitialAction [SelectAll 或 DeselectAll 之一]。

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文