Problem in displaying tooltip
-
Hi, I want to display a tooltip over a propertysheet whenever user will put the mouse cusor on its left or right border. I am using the following code
LRESULT MySubCard::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT result = 0;try { switch (message) { case WM\_LBUTTONDOWN: case WM\_RBUTTONDOWN: case WM\_MBUTTONDOWN: case WM\_LBUTTONUP: case WM\_RBUTTONUP: case WM\_MBUTTONUP: case WM\_MOUSEMOVE: { // Mouse messages must be relayed to tooltip control if (::IsWindow(mLeftToolTip.GetSafeHwnd())) { MSG msg; msg.hwnd = m\_hWnd; msg.message = message; msg.wParam = wParam; msg.lParam = lParam; if(Within left or rigth border) { mLeftToolTip.Activate(TRUE); mLeftToolTip.RelayEvent(&msg); } } } default: { break; } } result = CWnd::WindowProc(message, wParam, lParam); } catch (...) { } return result;
}
I am setting the tool using the following code
mLeftToolTip.AddTool(this, szToolTip, borderarea, ID_SPLITTER_TOOLTIP);
Though in windowproc RelayEvent is getting called for mouse movements but the tooltip is not getting displayed. Thanks
-
Hi, I want to display a tooltip over a propertysheet whenever user will put the mouse cusor on its left or right border. I am using the following code
LRESULT MySubCard::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT result = 0;try { switch (message) { case WM\_LBUTTONDOWN: case WM\_RBUTTONDOWN: case WM\_MBUTTONDOWN: case WM\_LBUTTONUP: case WM\_RBUTTONUP: case WM\_MBUTTONUP: case WM\_MOUSEMOVE: { // Mouse messages must be relayed to tooltip control if (::IsWindow(mLeftToolTip.GetSafeHwnd())) { MSG msg; msg.hwnd = m\_hWnd; msg.message = message; msg.wParam = wParam; msg.lParam = lParam; if(Within left or rigth border) { mLeftToolTip.Activate(TRUE); mLeftToolTip.RelayEvent(&msg); } } } default: { break; } } result = CWnd::WindowProc(message, wParam, lParam); } catch (...) { } return result;
}
I am setting the tool using the following code
mLeftToolTip.AddTool(this, szToolTip, borderarea, ID_SPLITTER_TOOLTIP);
Though in windowproc RelayEvent is getting called for mouse movements but the tooltip is not getting displayed. Thanks
When you move the mouse on the border of a window you get WM_NCMOUSEMOVE[^] and friends, not WM_MOUSEMOVE and his buddies. Althorough i doubt the tooltip control would react on these...maybe you could try "transforming" the non-client messages to client-messages when relaying to the tooltip.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
When you move the mouse on the border of a window you get WM_NCMOUSEMOVE[^] and friends, not WM_MOUSEMOVE and his buddies. Althorough i doubt the tooltip control would react on these...maybe you could try "transforming" the non-client messages to client-messages when relaying to the tooltip.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
-
Hi, thanks for replaying. I tried NC messages also but they are also not working. My doubt is that whether we can display tooltip for a region in a dialog or not. Thanks
Am not completely sure but it should work since as far as i know the dialog, from the perspecfive of the tooltip is just a CWnd like any other... How did you create the region you specified for it, what coords did you use? I think what you could do is to somehow calculate the border area's position in client coordinates and add these to the tooltip. Then, when WM_NCMOUSEMOVE comes in, convert the mouse coords to client coords of the window, and feed these to the tooltip with WM_MOUSEMOVE instead of WM_NCMOUSEMOVE. No idea if this would work or not, but it might be worth a try. So i mean something like this:
...
case WM_NCMOUSEMOVE:
{
CPoint Pt(lParam);
ScreenToClient(Pt);MSG msg;
msg.hwnd = m_hWnd;
msg.message = WM_MOUSEMOVE;
msg.wParam = wParam;
msg.lParam = MAKELPARAM(Pt.x, Pt.y);
mLeftToolTip.RelayEvent(&msg);
}
...[edit] Hey, i just tryed it out, you don't need all this fancypants "message converting" thing, if you feed the tooltip the coordinates of the borders in client-space then it will work flawlessly.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
modified on Wednesday, February 25, 2009 8:34 AM
-
Am not completely sure but it should work since as far as i know the dialog, from the perspecfive of the tooltip is just a CWnd like any other... How did you create the region you specified for it, what coords did you use? I think what you could do is to somehow calculate the border area's position in client coordinates and add these to the tooltip. Then, when WM_NCMOUSEMOVE comes in, convert the mouse coords to client coords of the window, and feed these to the tooltip with WM_MOUSEMOVE instead of WM_NCMOUSEMOVE. No idea if this would work or not, but it might be worth a try. So i mean something like this:
...
case WM_NCMOUSEMOVE:
{
CPoint Pt(lParam);
ScreenToClient(Pt);MSG msg;
msg.hwnd = m_hWnd;
msg.message = WM_MOUSEMOVE;
msg.wParam = wParam;
msg.lParam = MAKELPARAM(Pt.x, Pt.y);
mLeftToolTip.RelayEvent(&msg);
}
...[edit] Hey, i just tryed it out, you don't need all this fancypants "message converting" thing, if you feed the tooltip the coordinates of the borders in client-space then it will work flawlessly.
> The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <
modified on Wednesday, February 25, 2009 8:34 AM