Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Undo button question Collapse All
Subject Author Date
Denis Konovalov May 3, 2006 - 10:06 AM

I’m use CExtBarUndoRedoButton derived class to implement undo button in my application.
Button has SeparatedDropDown style, so list box opened by click on dropdown arrow.
I want to close listbox by clickig again on dropdown arrow (as in MS Visual Studio) or on undo arrow.
How can i do it?

Thanks.

Technical Support May 3, 2006 - 10:45 AM

Thank you for your comment. Please update the CExtPopupControlMenuWnd::_OnMouseClick() method’s source code in the ../Prof-UIS/Src/ExtPopupCtrlMenu.cpp file:

bool CExtPopupControlMenuWnd::_OnMouseClick(
    UINT nFlags,
    CPoint point,
    bool & bNoEat
    )
{
    ASSERT_VALID( this );
    bNoEat;
    if( GetSafeHwnd() == NULL )
        return false;
    if( GetSite().GetAnimated() != NULL )
        return true;
CExtPopupMenuSite & _site = GetSite();
    if(    _site.IsShutdownMode()
        || _site.IsEmpty()
        || _site.GetAnimated() != NULL
        )
        return true;
    if( _IsTearOff() && CExtPopupMenuWnd::_HitTest(point) == IDX_TEAROFF )
    {
        bool bLButtonUpCall =
            (nFlags==WM_LBUTTONUP || nFlags==WM_NCLBUTTONUP)
                ? true : false;
        if( ! bLButtonUpCall )
            _DoTearOff();
        return true;
    }
CPoint ptScreenClick( point );
    ClientToScreen( &ptScreenClick );
HWND hWndFromPoint = ::WindowFromPoint( ptScreenClick );
    if(       hWndFromPoint != NULL
        &&    (::GetWindowLong(hWndFromPoint,GWL_STYLE)&WS_CHILD) != 0
        &&    (    m_hWndChildControl == hWndFromPoint
              ||   ::IsChild( m_hWndChildControl, hWndFromPoint )
              )
        )
    {
        bNoEat = true;
        return false;
    }
HWND hWndFocus = ::GetFocus();
    if(       hWndFocus != NULL
        &&    (::GetWindowLong(hWndFocus,GWL_STYLE)&WS_CHILD) != 0
        &&    (    m_hWndChildControl == hWndFocus
              ||   ::IsChild( m_hWndChildControl, hWndFocus )
              )
        )
    {
        bNoEat = true;
        return false;
    }
HWND hWndCapture = ::GetCapture();
    if(       hWndCapture != NULL
        &&    (::GetWindowLong(hWndCapture,GWL_STYLE)&WS_CHILD) != 0
        &&    (    m_hWndChildControl == hWndCapture
              ||   ::IsChild( m_hWndChildControl, hWndCapture )
              )
        )
    {
        bNoEat = true;
        return false;
    }
bool bPtInWndArea = _PtInWndArea( point );
    if( bPtInWndArea )
    {
        if( m_bExcludeAreaSpec )
        {
            CRect rc = m_rcExcludeArea;
            ScreenToClient( &rc );
            if( rc.PtInRect( point ) )
            {
                bPtInWndArea = false;
                bool bLButtonDownCall =
                    ( nFlags == WM_LBUTTONDOWN || nFlags==WM_NCLBUTTONDOWN )
                        ? true : false;
                if( bLButtonDownCall )
                {
                    _OnCancelMode();
                    return false;
                }
            }
        }
    }
    if( ! bPtInWndArea )
    {
        if(     m_pWndParentMenu != NULL
            &&  m_pWndParentMenu->GetSafeHwnd() != NULL
            )
        {
            ASSERT_VALID( m_pWndParentMenu );
            ClientToScreen( &point );
            m_pWndParentMenu->ScreenToClient( &point );
            HWND hWndOwn = GetSafeHwnd();
            ASSERT( hWndOwn != NULL );
            ASSERT( ::IsWindow(hWndOwn) );
            CExtPopupMenuWnd * pWndParentMenu = m_pWndParentMenu;
            bool bInplaceControlArea = false, bInplaceDropDownArea = false;
            int nHtTemp =
                pWndParentMenu->_HitTest(
                    point,
                    &bInplaceControlArea,
                    &bInplaceDropDownArea
                    );
            if( nHtTemp >= 0 )
            {
                MENUITEMDATA & mi = pWndParentMenu->ItemGetInfo( nHtTemp );
                if(        mi.IsPopup()
                    &&    mi.GetPopup() == this
                    )
                {
                    if( bInplaceControlArea )
                    {
                        pWndParentMenu->_SetCapture();
                        pWndParentMenu->_ItemFocusCancel( FALSE );
                        pWndParentMenu->_ItemFocusSet( nHtTemp, FALSE, TRUE );
                        if( mi.IsAllowInplaceEditActivation() )
                        {
                            CWnd * pWndInplace = mi.GetInplaceEditPtr();
                            if( pWndInplace != NULL )
                            {
                                ASSERT_VALID( pWndInplace );
                                ASSERT( pWndInplace->GetSafeHwnd() != NULL && (::IsWindow(pWndInplace->GetSafeHwnd())) );
                                if( (pWndInplace->GetStyle() & WS_VISIBLE) == 0 )
                                {
                                    CRect rcInplaceEdit;
                                    pWndParentMenu->_GetItemRect( nHtTemp, rcInplaceEdit );
                                    rcInplaceEdit =
                                        mi.AdjustInplaceEditRect(
                                            rcInplaceEdit,
                                            OnQueryLayoutRTL()
                                            );
                                    pWndInplace->SetWindowPos(
                                        NULL,
                                        rcInplaceEdit.left, rcInplaceEdit.top,
                                        rcInplaceEdit.Width(), rcInplaceEdit.Height(),
                                        SWP_NOZORDER|SWP_NOOWNERZORDER
                                            |SWP_NOACTIVATE|SWP_SHOWWINDOW
                                        );
                                }
                                pWndInplace->SetFocus();
                            }
                        }
                    }
#if (!defined __EXT_MFC_NO_CUSTOMIZE)
                    CExtCustomizeCmdTreeNode * pNode = mi.GetCmdNode();
                    if( pNode == NULL )
                        return true;
                    if( (pNode->GetFlags()&__ECTN_TBB_SEPARATED_DROPDOWN) )
#endif
                        return true;
                }
            }
            if( pWndParentMenu->_OnMouseClick(
                    nFlags,
                    point,
                    bNoEat
                    )
                )
            {
                if( bNoEat )
                    return false;
                if( ::IsWindow(hWndOwn) )
                    CancelMenuTracking();
                return true;
            }
            return false;
        }
        if(      nFlags == WM_RBUTTONUP
            ||   nFlags == WM_LBUTTONUP
            )
            return true;
        _OnCancelMode();
        return false;
    }
bool bRetVal = false;
    if(      m_hWndChildControl != NULL
        &&   ::IsWindow( m_hWndChildControl )
        )
    {
        CONTROLINPUTRETRANSLATEINFO _ciri(
            this,
            false,
            nFlags,
            point,
            bNoEat
            );
        bRetVal = 
            ( ::SendMessage(
                m_hWndChildControl,
                g_nMsgControlInputRetranslate,
                (WPARAM)(&_ciri),
                (LPARAM)0L
                ) != 0 )
            ? true : false;
    }
    return bRetVal;
}


Denis Konovalov May 4, 2006 - 2:40 AM

thanks, it’s work