对于列表控件,“键入时查找”是否应该匹配条目的开头或条目中的任何位置?
我在 GTK+ 中有一个列表控件(一个带有一列的 gtk.TreeView
),启用了“键入时查找”(因此键入任何文本都会打开一个小搜索字段,用于搜索列表)条目)。 现在,如果用户输入一些搜索文本,例如“abc”,我应该只搜索以“abc”开头的条目,还是应该搜索文本中某处包含“abc”的条目?
(赞赏相关人机界面指南的链接)
I have a list control in GTK+ (a gtk.TreeView
with one column), with "find-as-you type" enabled (so typing any text will open a small search field for searching through the list entries). Now, if the user enters some search text like "abc", should I search only for entries starting with "abc", or should I search for entries that contain "abc" somewhere in their text?
(links to relevant Human Interface Guidelines appreciated)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
理想情况下,您键入的查找将对有序字符进行部分匹配,直到到达单词边界。 例如(伪代码):
这意味着对于
input = "Shing"
以及包含
{..., Sine, Shining, 'The Shining', ...} 的数据库
输出将为
{Shining, 'The Shining'}
当到达单词边界时,匹配应更改为匹配连续的单词部分。 粗略地:
这样对于
input = "Th Shi"
以及与上面相同的数据库
输出将为
{'The Shining'}
编辑(解决 UI 指南请求):您可能会做比观看此视频更糟糕的事情
ideally, a find as you type will do partial matching on ordered characters until a word boundary is reached. For example (in pseudo-code):
This means that for
input = "Shing"
And a database containing
{..., Sine, Shining, 'The Shining', ...}
The output will be
{Shining, 'The Shining'}
When a word boundary is reached, the matching should change to match contiguous word parts. Roughly:
Such that for
input = "Th Shi"
And the same database as above
The output will be
{'The Shining'}
Edit (Addressing the UI Guidelines request): You could do worse than watching this video
当然正确答案是取决于吗? 你的主题是什么?
如果您感到懒惰,我会投票支持文本中的任何位置或匹配文本中的任何整个单词(即不必匹配单词的中间)。
尽管在某些情况下,最好与第一个单词完全匹配。
Surely the correct answer is it depends? What is your subject matter?
I'd vote for anywhere in the text or matching any whole word in the text (i.e. not having to match the middle of words) if you are feeling lazy.
Although there are some instances where and exact match from the first word is preferable.
作为用户,我欣赏“包含”搜索而不是“开头为”。 有时您无法准确记住您要查找的内容,建议与您的搜索查询类似的内容比将其用作直接过滤器更有帮助。
有时也有多种方式列出某些内容,即:
等等。在我看来,输入“Shining”应该返回任何这些结果。
As a user, I appreciate a "contains" search rather than a "starts with". Sometimes you can't remember exactly what you're looking for and it's more helpful to suggest things that are similar to your search query rather than using it as a straight filter.
There are times when there are multiple way to list something as well, ie:
etc.. In my opinion, typing in "Shining" should return any of those results.
正如 Omer Kooheji 所说,正确答案很大程度上取决于列表框包含的内容。
然而,根据最小惊讶原则,我建议在开始时进行匹配一个条目; 这就是大多数列表框(例如在 Web 中、Linux 安装中的时区选择等)中发生的情况,因此这是大多数用户所期望的行为。
然而,这是一个通用的建议,不知道确切的应用。 如果您的应用程序是这样的,人们可能不知道确切的开始,但可能知道中间的一些子字符串,那么显然在任何地方匹配输入都更有意义。
As Omer Kooheji said, the correct answer depends a lot on what the listbox contains.
However, on the basis of the Principle of least astonishment, I would recommend matching at the start of an entry; that's the way it happens with most list boxes (in the Web, in time zone selection in Linux installations, etc. for example), so that is the behaviour that most users would expect.
However, that is a generic advice without knowing the exact application. If your application is such that people might not know the exact start but might know some substring in between, it obviously makes much more sense to match the input anywhere.