zoukankan      html  css  js  c++  java
  • duilib的caption上的Edit无法激活

    当窗口设置标题栏时,鼠标等控件可以相应,edit无法响应。

    主要和WindowImplBase::OnNcHitTest 虚函数有关。

    LRESULT WindowImplBase::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
    {
    POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
    ::ScreenToClient(*this, &pt);

    RECT rcClient;
    ::GetClientRect(*this, &rcClient);

    if( !::IsZoomed(*this) )
    {
    RECT rcSizeBox = m_PaintManager.GetSizeBox();
    if( pt.y < rcClient.top + rcSizeBox.top )
    {
    if( pt.x < rcClient.left + rcSizeBox.left ) return HTTOPLEFT;
    if( pt.x > rcClient.right - rcSizeBox.right ) return HTTOPRIGHT;
    return HTTOP;
    }
    else if( pt.y > rcClient.bottom - rcSizeBox.bottom )
    {
    if( pt.x < rcClient.left + rcSizeBox.left ) return HTBOTTOMLEFT;
    if( pt.x > rcClient.right - rcSizeBox.right ) return HTBOTTOMRIGHT;
    return HTBOTTOM;
    }

    if( pt.x < rcClient.left + rcSizeBox.left ) return HTLEFT;
    if( pt.x > rcClient.right - rcSizeBox.right ) return HTRIGHT;
    }

    RECT rcCaption = m_PaintManager.GetCaptionRect();
    if( pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right
    && pt.y >= rcCaption.top && pt.y < rcCaption.bottom ) {
    CControlUI* pControl = static_cast<CControlUI*>(m_PaintManager.FindControl(pt));
    if( pControl && _tcsicmp(pControl->GetClass(), _T("ButtonUI")) != 0 &&
    _tcsicmp(pControl->GetClass(), _T("OptionUI")) != 0 &&
    _tcsicmp(pControl->GetClass(), _T("TextUI")) != 0 &&
    _tcsicmp(pControl->GetClass(), _T("SliderUI")) != 0)
    return HTCAPTION;
    }

    return HTCLIENT;
    }

    在返回caption区域时,只排除了ButtonUI、OptionUI、TextUI、SliderUI四种控件。

    所以解决办法是:在派生自WindowImplBase的对话框中重写OnNcHitTest,将EditUI加进去即可。

  • 相关阅读:
    MySQL查询出错提示 --secure-file-priv解决方法
    导入csv文件到mysql
    Ubuntu16.04配置phpmyadmin
    TensorFlow安装(Ubuntu 16.04)
    github设置只识别指定类型的文件
    python file operations
    Ubuntu16.04 install flash plugin
    PRML读书笔记——3 Linear Models for Regression
    Ubuntu下查看机器信息
    PRML读书笔记——2 Probability Distributions
  • 原文地址:https://www.cnblogs.com/criticalsection/p/6148241.html
Copyright © 2011-2022 走看看