 |
|
 |
ZSF
|
|
|
|
 |
|
|
 |
|
 |
Very nice, I'm using it merrily.
One minor thing though:
When defining a general tooltip for the dialog itself,
m_pToolTip->AddTool(this, _T(".."));
we get at runtime two overlapping tooltips: one for the dialog window and the other for the control.
In addition, is there a way to change (programatically), the background tooltip color?
Thanks
alex
'Architecture is music frozen in space.'
|
|
|
|
 |
|
 |
I have used this class in a project. But i am getting "Debug Assertion Failed" error.
Its an SDI application. And i've used it to add tooltips in the OnCreate() as:
m_Tip.Create(this);
m_Tip.AddTool(m_wndToolBar.GetDlgItem(ID_FILE_SCAN), _T("Press this button!"), NULL);
m_wndToolBar.GetDlgItem(ID_FILE_SCAN) returns NULL. What might be the problem?
Thanx in advance..
|
|
|
|
 |
|
 |
Thank you !Thank you !Thank you !
Next question
Who could help implement feature copy from balloon ?
Thnx
djekk
|
|
|
|
 |
|
 |
A really nice class, simple to understand and has a fine look.
Caesten
Sunfire
|
|
|
|
 |
|
 |
This little class is great and it was excatly what I needed.
Keep coding, and again thanks!! JR
|
|
|
|
 |
|
 |
Nice work.
By the way, it displays tooltip for hidden buttons too.
I have several buttons on a window. Sometimes I need to hide some of them
but the tooltip still pops up.
|
|
|
|
 |
|
 |
Just what I needed. I wish more of the work in this forum was so easy to use, and logical to understand and extend.
John Norris
|
|
|
|
 |
|
 |
CXInfoTip::RelayEvent(LPMSG lpMsg)
//before
if (point != m_ptOrigin)
{
// Find the tool
pWindow = WindowFromPoint(point);
if (pWindow != NULL)
{
if (m_ToolMap.Lookup(pWindow->m_hWnd, Info))
{
// Display the tooltip
m_ptOrigin = point;
SetIcon(Info.hIcon);
Show(Info.szText, &point);
}
}
}
// Hide the tooltip
if (point != m_ptOrigin)
Hide();
//After, I think this will much better.
// Hide the tooltip
if (point != m_ptOrigin)
Hide();
if (point != m_ptOrigin)
{
// Find the tool
pWindow = WindowFromPoint(point);
if (pWindow != NULL)
{
if (m_ToolMap.Lookup(pWindow->m_hWnd, Info))
{
// Display the tooltip
m_ptOrigin = point;
SetIcon(Info.hIcon);
Show(Info.szText, &point);
}
}
}
|
|
|
|
 |
|
 |
I'm trying to use this class to display a data-tip in an ATL property page. When I call m_Tip.Create(), it returns 0. The call to CreateEx() in XInfoTip::Create() is failing. Any thoughts on how this can be fixed? Thanks.
|
|
|
|
 |
|
 |
Nice work buddy!
Is there any way to use this CXInfoTip with TrayIcon applications, ie application that uses Shell_NotifyIcon to process tooltips.
Thanks in advance.
|
|
|
|
 |
|
 |
Nice work.
One small problem with a 'balloon' like infotip,
is that when it pops up too close to the edge of
the screen it's partially off-screen.
That's easy to fix with a conventional tooltip,
but I guess not as simple with this one, because
of it's lack of symmetry.
|
|
|
|
 |
|
 |
First, I would like to say that I have found this class extremely useful, and a very simple and clear example of drawing custom non-rectangular windows.
Displaying the bubble to the right when it would display off the screen is a relatively easy fix. The only problem with the solution I am giving is that you will see a flicker of a left bubble before it is redrawn as a right bubble since I use the results of the initial region computation to determine whether the bubble will be clipped. This was done for efficiency, otherwise I would have to recompute the window region with every mouse move. (My application "floats" the bubble as the mouse moves over the screen and I call Show() with every mouse move to make the bubble follow the cursor). You can re-arrange the code I have given if this doesn't work for you.
First, add two new data members to CXInfoTip:
BOOL m_bLeftBubble;
CSize m_WindowSize;
Second, change the references to the local variable WindowSize to use the class variable m_WindowSize to store the computed size of the window (in the Show() method and the OnTimer() method).
Third, after getting the cursor position in the Show() method, determine whether the type of bubble. Basically, we will draw a left bubble if the origin offset by window size width yield a positive x coordinate, otherwise draw a right bubble.
m_bLeftBubble = m_ptOrigin.x - m_WindowSize.cx >= 0;
Fourth, change the triangle leader based on whether we are drawing a left or right bubble:
// Calculate the leader triangle coordinates
if ( m_bLeftBubble )
{
ptLeader[0].x = rcWnd.Width() - CX_ROUNDED;
ptLeader[0].y = rcWnd.Height() - CY_ROUNDED;
ptLeader[1].x = ptLeader[0].x;
ptLeader[1].y = ptLeader[0].y + CY_LEADER;
ptLeader[2].x = ptLeader[0].x - CX_LEADER;
ptLeader[2].y = rcWnd.Height() - CY_ROUNDED;
}
else
{
ptLeader[0].x = CX_ROUNDED;
ptLeader[0].y = rcWnd.Height() - CY_ROUNDED;
ptLeader[1].x = ptLeader[0].x;
ptLeader[1].y = ptLeader[0].y + CY_LEADER;
ptLeader[2].x = ptLeader[0].x + CX_LEADER;
ptLeader[2].y = rcWnd.Height() - CY_ROUNDED;
}
Finally, when showing the bubble, set the window position based on whether we are positioning the triangle leader for a left or right bubble in the OnTimer() function (replace the call to SetWindowPos to the conditional call within the timerShow case):
if ( m_bLeftBubble )
SetWindowPos(&wndTop, m_ptOrigin.x - m_WindowSize.cx + CX_ROUNDED, m_ptOrigin.y - m_WindowSize.cy + CY_ROUNDED, m_WindowSize.cx, m_WindowSize.cy, SWP_NOACTIVATE | SWP_SHOWWINDOW);
else
SetWindowPos(&wndTop, m_ptOrigin.x - CX_ROUNDED, m_ptOrigin.y - m_WindowSize.cy + CY_ROUNDED, m_WindowSize.cx, m_WindowSize.cy, SWP_NOACTIVATE | SWP_SHOWWINDOW);
That's it. It took me all of 15 minutes to do this, testament to the class author's good design. I am sure it would be equally simple to check for the top-screen clipping as well.
Regards,
Kurt
Kurt M. S.
|
|
|
|
 |
|
 |
Good work.
Small change allows the bubble to be to the right by default and switches to the left if there is not enough room.
I replaced the line
m_bLeftBubble = m_ptOrigin.x - m_WindowSize.cx >= 0;
with
#ifndef SM_CXVIRTUALSCREEN
#define SM_CXVIRTUALSCREEN 78
#endif
m_bLeftBubble = m_ptOrigin.x + m_WindowSize.cx >= GetSystemMetrics(SM_CXVIRTUALSCREEN);
Again, great work!
S.Hawkins
|
|
|
|
 |
|
 |
I realy like your class , but I couldn't help but make two minor improvements...
1) The tooltip window tends to flicker when moving your mouse cursor over the buttons. My quick fix was to use Keith Rule's CMemDC class in the "OnPaint()" call.
2) I noticed that occasionaly the tooltip would appear for a brief instant when moving my mouse cursor off the dialog. I tracked it down to a lagged "OnTimer(timerShow)" event that was still active even though the window had been hidden. My solution was two part (1) Add "KillTimer(timerShow);" to the "Hide();" function, and (2) replaced all the normal places where "ShowWindow(SW_HIDE);" with "Hide();"
Overall, this class was just what I was looking for Thanks for posting it.
|
|
|
|
 |
|
 |
I tried to incorporate the two source files into a project, but get a compile error on
CMap m_ToolMap; // Tools map
error C2143: syntax error : missing ';' before '<'
: error C2501: 'CMap' : missing storage-class or type specifiers
: error C2059: syntax error : '<'
: error C2238: unexpected token(s) preceding ';'
any suggestions as to what might cause this?
tia
|
|
|
|
 |
|
 |
Hi,
Be sure to #include <afxtempl.h> to use MFC collection templates.
Cheers,
Paolo
------
"airplane is cool, but space shuttle is even better" (J. Kaczorowski)
|
|
|
|
 |