gclxry / duilib

Automatically exported from code.google.com/p/duilib
0 stars 0 forks source link

SVN 315版本后导致TAB建无效了 #46

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
SVN 315版本后导致TAB建无效了

bool CPaintManagerUI::TranslateMessage(const LPMSG pMsg)
{
    // Pretranslate Message takes care of system-wide messages, such as
    // tabbing and shortcut key-combos. We'll look for all messages for
    // each window and any child control attached.
    HWND hwndParent = ::GetParent(pMsg->hwnd);
    UINT uStyle = GetWindowStyle(pMsg->hwnd);
    LRESULT lRes = 0;

    bool preHandled = false;
    for (int i = 0; i < m_aPreMessages.GetSize(); i++)
    {
        CPaintManagerUI *pT = static_cast<CPaintManagerUI *>(m_aPreMessages[i]);
        if (pMsg->hwnd == pT->GetPaintWindow()
            || (hwndParent == pT->GetPaintWindow() && ((uStyle & WS_CHILD) != 0)))
        {
            if (pT->PreMessageHandler(pMsg->message, pMsg->wParam, pMsg->lParam, lRes))
                return true;

            // 消息不再传递到TranslateAcce中,若存在多个窗口,加速键消息在webbrowser中被处理后
            // 会导致其他窗口内Edit部分按键消息(回格键、方向键)无法响应
            preHandled = true;
        }
    }

    if (!preHandled)
    {
        for (int i = 0; i < m_aPreMessages.GetSize(); i++)
        {
            CPaintManagerUI *pT = static_cast<CPaintManagerUI *>(m_aPreMessages[i]);
            if (pMsg->hwnd != pT->GetPaintWindow())
            {
                if (pT->TranslateAccelerator(pMsg))
                    return true;
            }
        }
    }

    return false;
}

Original issue reported on code.google.com by imnew...@gmail.com on 24 Jul 2012 at 12:23