(在选项卡控件上)通过控件进行选项卡自动通过 TabControl.tabs 进行分页的有效方法

发布于 2024-10-11 23:45:48 字数 762 浏览 5 评论 0原文

我尝试编辑此内容以区分 tabControl 上的“选项卡”和通过使用 Tab 键的控件进行的“选项卡”,但我只是要通电并希望含义清楚......

我有一个带有 tabcontrol 界面的 ac# 项目。 3 个选项卡页(个人信息、联系人详细信息、附加注释)以及每个选项卡中包含的相关控件。

我们的大多数用户发现仅使用键盘导航界面更容易(例如键盘快捷键和通过选项卡导航控件)。我已经包含了各种快捷键组合的键盘侦听器。例如,PageUp 和 PageDown 将允许用户翻阅各个选项卡。

然而,这些用户遵循相同的模式来输入信息:一旦他们通过“个人信息”选项卡的控件(根据需要填充)进行选项卡切换并到达选项卡上的最后一个控件,他们希望“继续选项卡”。如:当最后一个控件聚焦在 TabControl.Page1 上时,用户按 Tab 键会将焦点移动到 TabControl.Page2 上的第一个控件。当最后一个控件聚焦在 TabControl.Page2 上时,用户按 Tab 键会将焦点移动到 TabControl.Page3。

通过这种方式,信息被分组并包含在一起,用户只需继续键入和按 Tab 键即可输入表单上的所有信息,而无需使用键盘。

所以真正的问题是有效地做到这一点: 我不能只是简单地处理最后一个控件的 OnLeave:用户(在最后一个控件上)选择较早的控件(甚至是 shift-Tab)也会触发该事件。

另一个问题是维护:如果维护者忘记/不知道此“将焦点移至下一个选项卡”功能,则在选项卡底部添加另一个控件可能会导致整个事情失败。也许将最后一个控件添加到表单中?

I've tried editing this to differentiate between 'tabs' on a tabControl and 'tabbing' through controls with the tab key, but I'm just going to power through and hope the meaning is clear....

I have a c# project with an interface featuring a tabcontrol. 3 tab pages (PersonalInformation, ContactDetails, AdditionalNotes) and the relevant controls are contained within each tab.

Most of our users find it easier to navigate interfaces using the keyboard only (such as keyboard shortcuts and tabbing through controls for navigation). I've included keyboard listeners for various shortcut combinations. For example, PageUp and PageDown will allow users to page through the various tabs.

However, these users follow the same pattern for entering information: once they've tabbed through the PersonalInformation tab's controls (populating as need be) and reached the last control on the tab, they wish to 'keep tabbing'. As in: when last control focussed on TabControl.Page1, a user pressing tab will move focus to the first control on TabControl.Page2. When last control focussed on TabControl.Page2, a user pressing tab will move focus to TabControl.Page3.

In this way the information is grouped and contained together and users can simply keep typing and tabbing to enter all the information on the form, all without needing the keyboard.

So the real question is doing this effectively:
I can't just simply handle the OnLeave of the last control: a user (on the last control) selecting an earlier control (or even shift-Tab) would also fire the event.

Another problem is maintenance: Adding another control at the bottom of the tab could throw the whole thing off if the maintainer forgets/doesnt know that this 'move focus to next tab' feature. Perhaps getting the last control added to the form?

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

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

发布评论

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

评论(1

花伊自在美 2024-10-18 23:45:48

我已经重写了 ProcessDialogKey 方法来处理 Tab(和 Shift+Tab)击键,将 tabPages 和焦点转移到相关控件。从功能上来说,这是可行的。

维护问题

  • 这个特定的界面不会经常改变,并且仍在进行大量的可用性测试,以确定在发布之前什么最有效(因此我们最终可能会恢复)。

  • 坏处是焦点的转移是相当硬编码的。我没有看到任何特别简单的方法来一般性地处理这个问题。

  • 幸运的是,维护工作应该很少,因为只有 3 个选项卡页。业务逻辑完全封装在其他地方,因此业务功能不存在风险。代码包含在相关区域内,因此很容易发现。由于用户是“键盘爱好者”,并且在数据输入期间通过 Tab 键浏览所有内容,因此也可以很快发现错误。

    仍然欢迎任何意见/建议。

  • I've overridden the ProcessDialogKey method to handle the Tab (and Shift+Tab) keystrokes, shifting tabPages and focus to the relevant controls. Functionally speaking, this will work.

    Maintenance issues

  • This particular interface doesn't change often and there's still a fair amount of usability testing underway to determine what works best before its released (so we may end up reverting).

  • The bad thing is that shifting focus is pretty hard-coded. I don't see any particular easy way of handling this generically.

  • Fortunately, maintenance should be low as there's only 3 tabPages. The business logic is completely encapsulated elsewhere so there's no risk to business functions. Code contained within relevant regions so its easy to spot. Its also a pretty quick thing to spot going wrong as the users are 'keyboard enthusiasts' and tab through everything during data entry.

    Any comments/suggestions are still welcome.

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