控制输入​​焦点 [英] Controlling input focus

查看:68
本文介绍了控制输入​​焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个托管1个列表框和子表单的表单。子窗体顶部有一个组合框,后面跟着其他控件,这些控件被禁用,直到进行选择,然后是特定的键组合或击键。内部工作正常
到子窗体 -   Alt + M启用另一个组合框,将其初始化为一个值,然后启用文本框并将焦点设置到该文本框,以便用户可以输入任何她喜欢的内容。在该文本框具有焦点的情况下,Alt + M再次启用另一个文本框
并为其提供用户输入的焦点。所有这些都是花花公子。

I am working on a form that hosts 1 listbox and a subform. The subform has at the top, a combobox, followed by other controls that are disabled until a selection is made followed by specific key combinations or keystrokes. Everything works fine internally to the subform -- Alt+M enables another combobox, initializes it to a value, then enables a textbox and sets the focus to that textbox so the user can enter whatever she pleases. With that textbox having the focus, Alt+M again enables another textbox and gives it the focus for user entry. All that works dandy.

问题出在哪里是从主窗体的列表框导航。在AfterUpdate事件中,焦点移动到子窗体上的组合框。如果我使用鼠标单击列表框中的项目,这工作正常。但是,如果我在键盘上使用向下箭头或
向上箭头,则子窗体上的组合会将焦点转移到眨眼间,然后将其返回到listbox - mainform。实际上,如果我按下其中一个箭头键,焦点将移动到子窗体组合,并且在保持键时保持
的长度,只有在键为时才返回到主窗体列表框。发布。

Where the problem comes in is with navigating from the main form's listbox. In the AfterUpdate event, the focus moves to the combobox on the subform. That works fine if I use the mouse to click an item in the listbox. However, if I use the down-arrow or up-arrow on the keyboard, then the combo on the subform takes the focus for a blink of an eye and then it is returned to the listbox - mainform. In fact, if I hold down one of the arrow keys, the focus will move to the subform combo, and stays for as long as the key is held, only to return to the mainform listbox as soon as the key is released.

此外,我真正想要的是一个设置,如果我从子窗体组合中按{TAB},要设置公共变量,请将焦点移至主窗体列表框,以及要选择的列表中的下一个项目,将焦点移回子窗体组合。
我花了好几个小时试图让它工作但无济于事。在某一点上,当按下向上或向下导航键时,光标正在跳过列表框中的项目。似乎向下箭头的内在行为首先发生,选择
下一个项目,然后我的代码跟随读取该项目作为当前项目,然后选择下一个项目,导致我提到的双重移动。

Also, what Id really like to have, is a setup where if I press {TAB} from the subform combo, for a public variable to be set, focus to move to the mainform listbox, and the next item down the list to be selected, moving the focus back to the subform combo. I have spent hours trying to get this to work but to no avail. At one point, the cursor was skipping an item in the listbox when an up or down navigation key was pressed. It seems as though the intrinsic behaviour of the down arrow takes place first, selecting the next item, then my code follows reading that item as the current item, then selecting yet the next item down, causing that double move i mentioned.

任何halp将不胜感激

Any halp would be appreciated

推荐答案

blah blah blah

blah blah blah

链接怎么样......它更有意义,等等等等等等。我们可以比令人困惑的dia骂更好地阅读代码。

How about a link... its much more meaningful that blah blah blah. We can read code better than a confusing diatribe.

启用VS HTML编辑器辅助功能验证选项(请参阅工具>选项>文本编辑器> HTML)。如果您的网页无法访问(第508条)标准,它会发出警告。

Switch on your VS HTML editors Accessibility validation option (see Tools>Options>Text Editor>HTML). It will warn you if your web page fails Accessibility (Section 508) Standards.

如果您使用的是IE8,则可以使用验证>辅助功能> 508清单菜单选项来传递您的页面辅助功能验证程序。

If you are using IE8, you can use the Validate>Accessibility>508 Checklist menu option to pass your page through the Accessibility validators.

这些标准定义了如何构建网页以确保所有用途都可以导航页面的输入字段(并非每个用户都使用鼠标)。通常使用< label>< input>使用accesskey,for和tabindex属性配对以构建
网页中的流程和标签顺序。

These standards define how web pages should be constructed to ensure that all uses can navigate your page's input fields (not every user uses a mouse). Typically one uses <label><input> pairs with accesskey, for and tabindex attributes to structure the process flow and tab order in the web page.

问候。


这篇关于控制输入​​焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆