通过输入聚焦控件 [英] focusing a control by enter

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

问题描述

我正在做一个Windows应用程序。我希望通过按Enter键来控制焦点。例如,假设我的应用程序有5个文本框。此外,我在该文本框附近放了5个复选框。我检查了第2,第4和第5个复选框,然后保存了它。下次运行时,焦点应该在第二个复选框,按下回车键后,焦点应该转到第四个文本框。

如何做到这一点?

请帮助我。

谢谢....

I m doing a windows application.In that i want focus the control by pressing enter key. For example, Suppose my application having 5 text boxes. Also i put 5 check boxes near that text boxes. I checked 2nd,4th and 5th check boxes and i saved it. Next time of running, the focus should be in 2nd check box and after pressing enter key the focus should go to 4th text box.
how to do this?
pls help me.
thanks....

推荐答案

这是一个坏主意。

这是可能的 - 和甚至不那么困难 - 但这并不意味着你应该这样做。



在Windows中输入通常意味着我已经完成数据输入 - 保存它,和TAB的意思是我已经完成了这一点 - 继续前进。如果你通过选择ENTER键从一个字段移动到另一个字段来颠覆它,那么你的应用程序就不会像90%的其他应用程序一样工作,它会让你的用户感到困惑,或者他们甚至可以拒绝使用它。 />


建议您使用TAB,并且只需设置相应的Tab键顺序,在获取TextBox.Enter事件时检查复选框就可以了应该跳过那个字段。

它更容易实现,并且不会让用户如此混淆。
This is a bad idea.
It's possible - and not even that difficult - but that doesn't mean you should do it.

ENTER in windows normally means "I've finished entering by data - save it", and TAB means "I've finished entering this bit - move on". If you subvert that by co-opting the ENTER key to move from field to field, then your application doesn't work like 90% of other apps, and it can confuse your users, or they can even refuse to use it.

You would be a lot better advised to use TAB instead, and just set the tab-order appropriately, checking the checkboxes when you get the TextBox.Enter event to see it you should skip that field.
It's easier to implement, and doesn't confuse users so much.


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

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