(在选项卡控件上)通过控件进行选项卡自动通过 TabControl.tabs 进行分页的有效方法
我尝试编辑此内容以区分 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经重写了 ProcessDialogKey 方法来处理 Tab(和 Shift+Tab)击键,将 tabPages 和焦点转移到相关控件。从功能上来说,这是可行的。
维护问题
仍然欢迎任何意见/建议。
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
Any comments/suggestions are still welcome.