Click to See Complete Forum and Search --> : mouse over a pushbutton
April 10th, 1999, 02:28 PM
I can use the CPoint object for knowing position in a dialog box. How can I tell if my mouse is positioned over a pushbutton. This would be similar to a tooltip however, I don't want to tell the user what the pushbutton does. I want to do something else if they are over the pushbutton. This will be done in OnMouseMove()
Daniel Levine
April 10th, 1999, 05:38 PM
Hi,
You could do something like this:
CRect rectButton;
POINT ptCursorPos;
GetDlgItem(IDC_YOURBUTTON)->GetWindowRect(rectButton);
GetCursorPos(&ptCursorPos);
if (rectButton.PtInRect(ptCursorPos))
{
// Do Something
}
Daniel.
Dave Lorde
April 12th, 1999, 06:02 AM
Do the check from within the MouseMove handler (which passes you the current mouse position), by getting the window rect of the button as Daniel suggests.
Dave
Saeed R
May 10th, 1999, 07:04 PM
i m sure i downloaded some project from CODEGURU a week ago that was doing what you wanted...serach i the articles published and there is a downloadable one that does what you want..........
sally
May 10th, 1999, 08:10 PM
Subclass the pushbuttons and in its OnMouseMove go and do your stuff.....
Sally
Sally
May 10th, 1999, 08:10 PM
Subclass the pushbuttons and in its OnMouseMove go and do your stuff.....
Sally
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.