|
-
May 23rd, 2009, 04:48 AM
#1
Tooltip display fails
PHP Code:
void CMyToolTip::InitToolTip(HWND hParentWnd)
{
if(m_toolTip.m_hWnd)
{
m_toolTip.Create(CWnd::FromHandle(hParentWnd),WS_POPUP|TTS_BALLOON);
m_toolTip.Activate(FALSE);
}
}
void CMyToolTip::SetToolTipText(LPCTSTR lpToolTipTxt, HWND hParentWnd, BOOL bActivate)
{
if(NULL==lpToolTipTxt) return;
InitToolTip(hParentWnd);
if(0==m_toolTip.GetToolCount())
{
CRect rcPic;
::GetClientRect(hParentWnd,&rcPic);
m_toolTip.AddTool(CWnd::FromHandle(hParentWnd), lpToolTipTxt, &rcPic,1);
}
m_toolTip.Activate(bActivate);
m_toolTip.UpdateTipText(lpToolTipTxt,CWnd::FromHandle(hParentWnd),1);
}
I have tried the above code to display a balloon tooltip when my mouse is over the picture control but it doesn't show me anything at all. Could you help me ?
Thanks
-----
-
May 23rd, 2009, 04:58 AM
#2
-
May 23rd, 2009, 05:08 AM
#3
Re: Tooltip display fails
static control that is to hold a bitmap with frame/etch/bitmap etc or say a bitmap control
I have declared a variable m_pic and I get the handle to this bitmap easily m_pic.hWnd hehehe
Handling mouse messages is fine, only the tooltip doesn't show up and I am really LONG long for it.
What is wrong ?
Last edited by yuenqi; May 23rd, 2009 at 05:48 AM.
-----
-
May 24th, 2009, 05:54 AM
#4
Re: Tooltip display fails
Check your if statement in your InitToolTip.
-
May 24th, 2009, 11:32 AM
#5
Re: Tooltip display fails
Thanks I see m_hWnd=0x0000000
How should I fix this ?
-----
-
May 24th, 2009, 12:49 PM
#6
Re: Tooltip display fails
Your "m_toolTip.Create" creates the tooltip, so you want something like:
Code:
void CMyToolTip::InitToolTip(HWND hParentWnd)
{
if(!m_toolTip.m_hWnd)
{
m_toolTip.Create(CWnd::FromHandle(hParentWnd),WS_POPUP|TTS_BALLOON);
m_toolTip.Activate(FALSE);
}
}
-
May 25th, 2009, 12:23 PM
#7
Re: Tooltip display fails
Sorry,
if(!m_toolTip.m_hWnd)
was what I had in my original source code, the above snip was copied incorrectly. I dont see the balloon display when mouse is over. I don't know why.
-----
-
May 25th, 2009, 12:27 PM
#8
Re: Tooltip display fails
Can you post a small demo project with the problem? Remove temporary files.
-
May 25th, 2009, 12:32 PM
#9
Re: Tooltip display fails
I will send you in email Ok ? no other information except deed for help on this problem is included
-----
-
May 25th, 2009, 12:36 PM
#10
Re: Tooltip display fails
ok, but why not post it on the forum, so other members might also take a look at it?
-
May 25th, 2009, 12:54 PM
#11
Re: Tooltip display fails
Ok, I will but not now, because I am very far away from home and I don't have the source code included in my usb to extract up here.
Later!
-----
-
May 25th, 2009, 01:13 PM
#12
Re: Tooltip display fails
One other thing, did you add a call to RelayEvent?
Something along the lines like:
Code:
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg)
{
m_toolTip.RelayEvent(pMsg);
return CWnd::PreTranslateMessage(pMsg);
}
-
May 27th, 2009, 12:38 PM
#13
Re: Tooltip display fails
Thank you very much for your help
But I have to tell you that your help is yet to be sufficient to make the program work. I have to save my class's handle for use in my dialog. That is 1:1 I mean.
-----
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|