接受按钮 [英] Accept Button

查看:65
本文介绍了接受按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在FORM1上有一个按钮,它是该表单的接受按钮,我按下回车键并触发了接受按钮的点击事件,该按钮打开另一个表单(FORM2)并在控件上选择。获得焦点的控件有一个keydown事件
处理程序,当点击它时,它应该做一些事情。现在发生的事情是,当我进入FORM1时,它会导致该窗体事件上的接受按钮触发,并且控件的按键也会关闭,以便激活FORM2。如何避免
输入键同时触发2个事件,为什么会发生? (我需要那个控制来获得焦点,这样就不会有办法避免这个问题。) 

I have a button on FORM1 that is the accept button of that form, and I press the enter key and the accept button's click event is fired, that button opens up another form (FORM2) and selects on a control. The control that gets the focus has a keydown event handler that when enter is clicked on it should do something. What happens now is that when I enter on FORM1 it causes the accept button on that forms event to fire and also the key down of the control that is getting focus on FORM2 to fire. How can I avoid the enter key to simultaneously fire 2 events, and why is it happening? (I need that control to get the focus so that would not be a way to avoid this problem.) 

推荐答案

问候黛布拉。

你所描述的不应该发生。我试过写一个小测试程序而不能复制它。

What you describe shouldn't happen. I have tried writing a little test program and can't replicate it.

我怀疑当第二个表单打开并且它"选择一个控件"时问题出现了。你如何选择控件?你能告诉我们一些示例代码吗?我怀疑你正在做的是发送一个KeyDown事件。

My suspicion is that when the second form opens up and it "selects on a control" that the problem arises. How do you select the control? Can you show us some sample code? I suspect that whatever you are doing is sending a KeyDown event.


这篇关于接受按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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