如何实现编辑框序列 [英] How do I implement an Edit Box Sequence

查看:95
本文介绍了如何实现编辑框序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MS使用多年.在第一个框中输入您的产品代码,下一个键(5个字符后)将进入下一个框中,依此类推等等.有什么想法吗?

问候,

:rose:

MS Uses it for years. Type your Product Code starting in the first box, the next key (after 5 chars) lands into the next box, etc etc Any idea how to do that?

Regards,

:rose:

推荐答案

嘿...这很容易做到.

只需在每次按键上检查字符的长度即可.如果找到限制,则将焦点设置到下一个文本框.

您还需要跟踪BackSpace并对其进行相反的操作.

:)
Hey... this is very easy to do.

Just on every keypress, check the length of the characters. If you find the limit, set focus to the next textbox.

You also need to track BackSpaces and do the reverse for it.

:)


处理所有编辑框的EN_CHANGE通知.
调用lParam上的GetDlgItemText以获取文本并检查其长度.
如果长度为5,则调用SetFocus将闪烁的光标设置到下一个编辑框.
GetDlgItem为您提供控件的句柄.
Handle the EN_CHANGE Notification for all edit boxes.
Call GetDlgItemText on the lParam to get the text and check its length.
If the length is 5, call SetFocus to set the blinking cursor to the next edit box.
GetDlgItem gives you the handle to a control.


这篇关于如何实现编辑框序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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