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 » How to Display ToolTip Message on any Window ? Collapse All
Subject Author Date
Srinivasan Natarajan Nov 19, 2005 - 12:38 AM

HI,


The tooltip sample message was working fine. we would like to know whether is there a way to display the message on any window (CView or any other)?


email:sundar@cynaptix.com


regards


sundar


 


 

Srinivasan Natarajan Nov 21, 2005 - 2:34 AM

Hi,


I tried to display it on the View , when the View is maximised i am not able to see the tooltip message . I would like to see the tooltip message on the mouse pointer location. How to achieve this ?


regards


sundar

Technical Support Nov 21, 2005 - 12:22 PM

To help you, we coded a simple MDI application. The view window in the MDI child frame window draws a small red rectangle. You can see a balloon tip over it. Please download the sample project from here. The source code is very simple. We added the following members to the CTestView view class:

    CExtPopupMenuTipWnd m_wndCoolTip;
    CRect m_rcToolRect;
The m_rcToolRect member specifies location of the red rectangle. It is initialized in the constructor:
CTestView::CTestView()
    : m_rcToolRect( 50, 50, 100, 100 )
{
    // TODO: add construction code here
 
}
The CTestView::OnDraw() virtual method draws the red rectangle:
void CTestView::OnDraw(CDC* pDC)
{
    CTestDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    // TODO: add draw code for native data here
 
    pDC->FillSolidRect( &m_rcToolRect, RGB(255,0,0) );
}

Finally, we have added the WM_MOUSEMOVE message handler to make cool tip window working:
 
void CTestView::OnMouseMove(UINT nFlags, CPoint point) 
{
    // TODO: Add your message handler code here and/or call default
 
    if( m_rcToolRect.PtInRect( point ) )
    {
        if(  m_wndCoolTip.GetSafeHwnd() == NULL
            || (m_wndCoolTip.GetStyle()&WS_VISIBLE) == 0
            )
        {
            CRect rcTrack = m_rcToolRect;
            ClientToScreen( &rcTrack );
            m_wndCoolTip.SetText( "cooltip" );
            m_wndCoolTip.Show( this, rcTrack );
        }
    }
    else
        m_wndCoolTip.Hide();
 
    CView::OnMouseMove(nFlags, point);
}


Technical Support Nov 20, 2005 - 10:18 AM

What we demonstrated you in the dialog sample you had requested works over any window. So, let us know more details on you application (MDI, SDI, etc) and windows you would like to show tooltips over?