tooltip quits tipping |
Post Reply |
Author | |
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
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);} |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
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.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Without demo application its hard to suggest something. :(
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rdhd
Senior Member Joined: 13 August 2007 Location: United States Status: Offline Points: 886 |
Post Options
Thanks(0)
|
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.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |