Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Strange tooltip behaviour?!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Strange tooltip behaviour?!

 Post Reply Post Reply
Author
Message
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1198
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Topic: Strange tooltip behaviour?!
    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 19.0.0, new Projects v 19.1.0
Platform: Windows 10 v 1909 (64bit)
Language: VC++ 2017
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.152 seconds.