Print Page | Close Window

tooltip quits tipping

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Controls
Forum Description: Topics Related to Codejock Controls
URL: http://forum.codejock.com/forum_posts.asp?TID=13107
Printed Date: 04 December 2024 at 9:29pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: tooltip quits tipping
Posted By: rdhd
Subject: tooltip quits tipping
Date Posted: 07 January 2009 at 3:20pm

I posted earlier about having problems with a tooltip on a window with no controls. I have almost fixed that problem by giving the window its own tooltip context and overriding PretranslateMessage and calling FilterToolTipMessage on the new/private context. My change did fix the issue of clicking in a view stopping the tip from ever showing up (when that happened all I had to do to get it to start working again was move the mouse over a docking pane.) I did have to add a static flag to know when to let OnToolHitTest actually process since the window is not modal and the system tooltip context calls OnToolHitTest too (if I don't a tip shows up once and never ever goes away.)

However sometimes the tip still just quits showing up. I have found that when this happens, if I break in OnToolHitTest and after calling FillInToolInfo step back out of the function until I get to this line in FilterToolTipMessageHelper:

BOOL bTipInfoChanged = m_lastInfo.uId != tiHit.uId || m_lastInfo.hwnd != tiHit.hwnd;

and change bTipInfoChanged from FALSE to TRUE so the code in the following if statment is executed, the tip starts working again.

Is there some problem with tipping when the window has no controls in it? Here is my hit test code - does anything look out of the ordinary?
 

INT_PTR CTransparentWnd::OnToolHitTest(CPoint point, TOOLINFO* pTI) const

{

if( !s_bTest ) return 0;

pTI->hwnd = m_hWnd;

pTI->uId = (WPARAM)m_hWnd;

pTI->uFlags |= (TTF_IDISHWND | TTF_NOTBUTTON | TTF_ALWAYSTIP);

CRect rect;

rect.SetRectEmpty();

GetClientRect( &rect );

CXTPToolTipContext::FillInToolInfo( pTI, pTI->hwnd, rect, pTI->uId, m_strTooltilDescription, m_strTooltipTitle, m_strTooltilDescription );

return 1;

}

BOOL CTransparentWnd::PreTranslateMessage(MSG* pMsg)

{

s_bTest = true;

m_ToolTipContext.FilterToolTipMessage(this, pMsg);

s_bTest = false;

return CWnd::PreTranslateMessage(pMsg);

}




Replies:
Posted By: rdhd
Date Posted: 07 January 2009 at 5:37pm
Oleg,
 
My original problem and the new one seem to both be related to your code calling CancelToolTips when the mouse down event occurs. When called CXTPToolTipContextToolTip::Activate(FALSE) is called.
 
Once it is called, no other call to XTPToolTipContextToolTip::Activate(TRUE) is ever made. My forcing bTipInfoChanged to true allows the code in the if statement to call pToolTip->SendMessage(TTM_ACTIVATE, TRUE) and that is why it starts working again (until another mouse down event occurs).
 
I have tried tricking the code by not setting the TTF_IDISHWND and changing the uID on each call but no tip at all shows. If I leave the flag in and set the uId to my window's handle but change the rect, the tip goes into a constant display refresh (strobes) or doesn't show at all.
 
About the only thing I could find was to subclass so I can get to the tooltip member and after a mouse event occurs, I have my subclass send the TTM_ACTIVATE (true) message to the tip. That seems to work but I keep thinking there should be some more simple way to start the tip working again.


Posted By: Oleg
Date Posted: 08 January 2009 at 1:22am
Hello,
Without demo application its hard to suggest something. :(


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: rdhd
Date Posted: 09 January 2009 at 6:29pm
When the if statement that tests bTipInfoChanged is not true, would it hurt to activate the tip in addition to calling RelayToolTipMessage? That way if it got deactivated for whatever reason, it would be reactivated when a hit occurred.
 
That is esentially what I am doing to address the issue (I subclassed your context so I could get to the protected tooltip and send the TTM_ACTIVATE message to it whenever I detect the same message that caused your to deactivate it.



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