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 General Discussion » Overriding CExtButton's OnAdvancedPopupMenuTipWndDisplay method to move where the tooltip will be di Collapse All
Subject Author Date
steven frierdich Jan 29, 2007 - 12:51 PM

I have a class derived from CExtButton and the balloon tooltip’s origin always appears in the upper right hand corner of the button. No matter where the mouse cursor is on the button. I would like the origin of the tooltip to appear in upper left hand corner.
So I override the OnAdvancedPopupMenuTipWndDisplay method, and pass my own RECT structure to the CExtPopupMenuTipWnd Show method. Doing this let the tooltip origin appear in the upper left hand corner of the button but messes up when to tooltip should be hidded. The mess up is the m_rcExcludeArea.PtInRect() method call in the CExtPopupMenuTipWnd’s Timer method which is used to hide the tooltip by handling ID_TIMER_DELAY_KILL which determines when the tooltip window should be hidden. The rcExcludeArea is set equal to the RECT structure send which where the right parameter is only 20 pixels about from the left parameter of the RECT structure. There is no easy fix for on my end since all the PROF-UIS code is wrapped in so many classes and methods, with some methods being like 5 pages long.

Does anyone know an easy way to display the tooltip so it will always appear in the upper left corner of the button without in instantly disappearing once the mouse cursor goes outside the RECT structure I pass on to the show method?

Below is the OnAdvancedPopupMenuTipWndDisplay method I override , and also the ID_TIMER_DELAY_KILL handled in the Timer method.

void CLifeBtn::OnAdvancedPopupMenuTipWndDisplay(
    CExtPopupMenuTipWnd & _ATTW,
    const RECT & rcExcludeArea
    ) const
{
    ASSERT_VALID( this );
    if( ! m_bToolTipActive )
        return;
    if( m_strToolTipText.IsEmpty() )
        return;
    _ATTW.SetText( LPCTSTR(m_strToolTipText) );
    _ATTW.SetTipStyle( (CExtPopupMenuTipWnd::e_tip_style_t)m_nAdvancedTipStyle );
    RECT rectToolTip = {rcExcludeArea.left,rcExcludeArea.top,rcExcludeArea.right,rcExcludeArea.bottom};
rectToolTip.right = rectToolTip.left +20;
    _ATTW.Show( (CWnd*)this, rectToolTip );
}

    case ID_TIMER_DELAY_KILL:
        POINT ptCursor = { 0, 0 };
        if(        ::GetCursorPos( &ptCursor )
            &&    m_rcExcludeArea.PtInRect(ptCursor)
            )
            return;
        Hide();
        return;
    } // switch( nIDEvent )