Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - tooltip quits tipping
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

tooltip quits tipping

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

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: tooltip quits tipping
    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);

}

Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 January 2009 at 1:22am
Hello,
Without demo application its hard to suggest something. :(
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post 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.
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.172 seconds.