I think that it happens in WindowXP only because many CHoverButtons in Windows 2K there were no problem. When mouse over the button my cursor's shape is changed to the Information graphic suddenly. The solution is like below. In your CHoverButton::CHoverButton() function add next initialization code. m_CursorHand = NULL; It will work well. And thanks to the author for great work.
ReplyOriginally posted by: james
How do you create this button dynamically and still have the tooltip work?
Reply
Originally posted by: Don
Using a modeless dialog, the tool tip does not appear to work because the PreTranslateMessage() does not get called.
How can I get around this???
Thanks in advance,
Don
Originally posted by: Kanghee Im
fixed source is below.
BOOL CHoverButton::LoadBitmap(UINT bitmapid)
}
you can find some error if you use the class on child dialog.
from the second view, the image does not correctly initialized. so you only see the hover image.
{
m_bHover = FALSE; // add this code
mybitmap.Detach(); // thanks C
//original code-----------------------------------
mybitmap.Attach(::LoadImage(::AfxGetInstanceHandle(),MAKEINTRESOURCE(bitmapid), IMAGE_BITMAP,0,0,LR_LOADMAP3DCOLORS));
//mybitmap.LoadBitmap(bitmapid);
BITMAP bitmapbits;
mybitmap.GetBitmap(&bitmapbits);
m_ButtonSize.cy=bitmapbits.bmHeight;
m_ButtonSize.cx=bitmapbits.bmWidth/3;
SetWindowPos( NULL, 0,0, m_ButtonSize.cx,m_ButtonSize.cy,SWP_NOMOVE | SWP_NOOWNERZORDER );
return TRUE;
Originally posted by: Jaisor
First of all, thanks for the excelent code, saved me days of looking up.
I noticed an annoying bliking when the mouse enters and leaves the button, it is caused by the erasing on every Invalidate() so I used Invalidate(FALSE) which prevents erasing and it worked like a charm.
ReplyOriginally posted by: Cho Yong Kil
but CHoverButton is different.
BOOL CHoverButton::PreTranslateMessage(MSG* pMsg)
generally, standard buttons are dont use WM_LBUTTONDBLCLK message. cause we shown effect of button when click fast.
{
InitToolTip();
m_ToolTip.RelayEvent(pMsg);
// Add this source code!!
if( pMsg->message == WM_LBUTTONDBLCLK )
{
pMsg->message = WM_LBUTTONDOWN;
}
// Add this source code!!
return CButton::PreTranslateMessage(pMsg);
}
Originally posted by: TheFlashback
You have no idea how many troubles Set/Release Capture() brings. This code is neat and awesome. _TrackMouseEvent is just freaking splendid!
Originally posted by: Henry Park
Thanks...
Having trouble displaying tooltip text using "hover" class in an ActiveX control. The "hover" part works fine, but the tooltip text does not appear. If someone can help me, I'll send some code to look at.
Originally posted by: Anand Raval
Hi Niek,
Thanks a lot. You've saved my lots of research time! It is really great help to me.
Thanks again,
Anand
Originally posted by: mutter21
Good!! It's very simple code!!
Thank you.. *^^*
Reply