如何为除按键事件以外的Enter键分配条件 [英] how to assign condition for Enter key other than key events

查看:96
本文介绍了如何为除按键事件以外的Enter键分配条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个文本框和listview,在listview中绑定一些值,默认情况下
按下向上和向下键可以正常工作.通过在列表视图中选择并按Enter按钮,列表视图项显示在文本框中,此输入条件放置在listview_keydown事件中,这是将输入条件放置在listview_keydown事件中会影响向上和向下键的问题,这些键在放置输入条件.有什么解决方案?

Hi,

I have one textbox and listview, in listview binding some values, by default when
pressing up and down keys working fine. By selecting and press the enter button in listview, the listview item was displayed in textbox, this enter condition is placed in listview_keydown event, this is the problem placing enter condition in listview_keydown event effects the up and down keys, these keys are not working after placing the enter conditon. what is solution for this?
and any possibility to put the enter key condition other than keyevents, if possible what is the code?

推荐答案

听起来像是焦点问题:

当用户按下Enter键时,您的文本框将显示一些详细信息.

我想,TextBox在此过程中得到了关注.将焦点转移到TextBox会将其从ListView中删除.因此,键盘输入不会对ListView产生任何进一步的影响.

显示详细信息后,文本框是否具有焦点?如果是这样,您应该能够使用箭头键在TextBox内移动光标.
好消息是,如果TextBox具有焦点,则可以通过
将其移交给ListView.
Sounds like a problem with the focus:

When user presses Enter, your TextBox displays some details.

I suppose, the TextBox gets focus in the process. Transferring focus to the TextBox removes it from the ListView. Therefore keyboard input doesn''t have any further influence on the ListView.

Does the TextBox have focus after displaying details? If so, you should be able to move the cursor around within the TextBox using the arrow keys.
The good news is that if the TextBox has focus, it can hand it over back to the ListView via
listView1.Focus();

紧接在文本框中显示详细信息的代码部分之后.

right after the code part that displays details in the TextBox.


这篇关于如何为除按键事件以外的Enter键分配条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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