Print Page | Close Window

Strange tooltip behaviour?!

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=19946
Printed Date: 16 November 2024 at 12:19pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Strange tooltip behaviour?!
Posted By: mgampi
Subject: Strange tooltip behaviour?!
Date Posted: 11 July 2012 at 9:58am
Hi;

I'm using a report control inside a dialog that is shown as a custom popup in ribbon control.
When the user opens a combo drop down listbox some dialog buttons are hidden by this listbox. When the mouse cursor is moved over the area of the hidden button behind the lisbox (the area is currently occupied by the listbox), the tooltip of this button appears in front of the shown combo listbox.
What's going on here? I can't find out how to stop the tooltip from showing, while the combo listbox is shown.

To see the problem take a look at the screenshot below:



I use this code inside the dialog class to bring up the tooltips:

INT_PTR CReportConditionDlg::OnToolHitTest( CPoint point, TOOLINFO* pTI ) const {
    HWND hWndChild = NULL;
    ::ClientToScreen(m_hWnd, &point);
    HWND hChild = ::GetWindow(m_hWnd, GW_CHILD);
    for (; hChild != NULL; hChild = ::GetWindow(hChild, GW_HWNDNEXT))
    {
        if ((UINT)(WORD)::GetDlgCtrlID(hChild) != (WORD)-1 &&
            (::GetWindowLong(hChild, GWL_STYLE) & WS_VISIBLE))
        {
            CRect rect;
            ::GetWindowRect(hChild, rect);
            if (rect.PtInRect(point))
            {
                hWndChild = hChild;
                break;
            }
        }
    }

    if (hWndChild != NULL && ::IsWindowEnabled(hWndChild))
    {
        // return positive hit if control ID isn't -1
        INT_PTR nHit = (UINT)(WORD)::GetDlgCtrlID(hWndChild);

        // hits against child windows always center the tip
        if (pTI != NULL && pTI->cbSize >= sizeof(XTP_TOOLTIP_TOOLINFO))
        {
            CString Tooltip;
            if (Tooltip.LoadString(static_cast<UINT>(nHit)) && !Tooltip.IsEmpty()) {

                CString Caption, Description;
                AfxExtractSubString(Caption, Tooltip, 0, L'\n');
                AfxExtractSubString(Description, Tooltip, 1, L'\n');

                CXTPEmptyRect rect;
                CXTPToolTipContext::FillInToolInfo(pTI, m_hWnd, rect, reinterpret_cast<INT_PTR>(hWndChild), Caption, Caption, Description, &Images_);

                pTI->uFlags|=TTF_IDISHWND;
                if (!(::SendMessage(hWndChild, WM_GETDLGCODE, 0, 0) & DLGC_BUTTON))
                    pTI->uFlags |= TTF_NOTBUTTON|TTF_CENTERTIP;

                return nHit;
            }
        }
    }
    return -1;  // not found
}


Any help is welcome!


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net