在将焦点设置为CHtmlEditView时触发的终止焦点事件 [英] Kill focus event triggered on setting focus to CHtmlEditView

查看:78
本文介绍了在将焦点设置为CHtmlEditView时触发的终止焦点事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有这个异常的问题,我似乎无法弄清楚.

我正在使用CHtmlEditView对话框,当HTMLEditView失去控件时,我需要编写一些功能.
我尝试以相同的方式处理WM_KILLFOCUS事件,但是当我单击HTMLEditView而不是单击其他位置时会调用该事件:(

请帮我.


我尝试处理对话框的预翻译消息.但是函数永远不会被调用

Hi,

i have this unusual problem that i just cant seem to figure out.

i am using a dialog with CHtmlEditView, i need to write some functionality when the HTMLEditView looses control.
i tried handling the WM_KILLFOCUS event for the same, but it gets invoked when i click the HTMLEditView instead of clicking elsewhere :(

Kindly do help me with the same.


i tried handling the pretranslate message for the dialog. but the function never gets called

<pre lang="c++"> BOOL ::PreTranslateMessage( MSG* pMsg )
    {
        if (pMsg->message == WM_KILLFOCUS )
        {
                   AfxMessageBox( _T( "KILL" ));
        }
        return CHtmlEditView::PreTranslateMessage( pMsg );



任何人都可以请帮助我....:(



can anyone please please help me.... :(

推荐答案

这是正常现象.您只需要了解:您不需要其他东西.当然,如果单击其他位置"(应表示不在其他可聚焦控件上"),则不会发送Windows消息WM_KILLFOCUS,但是焦点不会转移.焦点是键盘焦点:在任何给定时刻,只有一个整个系统的控件都可以拥有它.失去焦点的唯一方法是集中其他控件;间接地,也可以通过激活顶层窗口来实现,该窗口不是可聚焦的,而是将焦点集中在其中一个控件上,随便.

在所有情况下,当控件失去焦点时,它都会在发生之前获取消息WM_KILLFOCUS,请参见 ^ ].

—SA
This is normal behavior. You simply need to understand: you don''t need anything else. Of course, if you click "elsewhere", which should mean "not on other focusable control", the windows message WM_KILLFOCUS is not sent, but focus is not shifted. The focus is a keyboard focus: at any given moment, only one control of the whole system can have it. The only way to loose focus is to focus some other control. Indirectly, it can also happen with activation of the top-level window, which is not focusable but gives the focus to one of its controls, it any.

In all cases, when a control looses focus, it gets the message WM_KILLFOCUS before it happens, see http://msdn.microsoft.com/en-us/library/windows/desktop/ms646282%28v=vs.85%29.aspx[^].

—SA


这篇关于在将焦点设置为CHtmlEditView时触发的终止焦点事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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