|
-
September 3rd, 2009, 05:54 PM
#1
An override method to release wm_mousewheel message from cslider control
Hello beautifull goys !
the mouse message WM_MOUSEWHEEL is strongly linked with the slider movement.
In order to release the mouse message WM_MOUSEWHEEL from the CSlider control I tryed the following solution (overriding):
1) I make a CSliderCtrl derived class (CMySliderCtrl) and add member variable and function :
private:
bool m_allowMouseActivation;
//
public:
void SetMouseActivation(bool activate);
2) initialized the variable in the constructor
CMySliderCtrl::CMySliderCtrl()
{
m_allowMouseActivation = true;
}
3) in the derived class I overrided the message WM_MOUSEWHEEL :
BOOL CMySliderCtrl::OnMouseWheel(UINT nFlags, short zDelta, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_allowMouseActivation)
CSliderCtrl::OnMouseWheel(nFlags, zDelta, point);
}
4) code for function to change mouse activation
void CMySliderCtrl::SetMouseActivation(bool activate)
{
m_allowMouseActivation = activate;
}
5) then to set the mouse activation, , I added lines like this in CMyProgramDlg:
BOOL CMyProgramDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_slider.SetMouseActivation(false);
CSliderCtrl::OnMouseWheel(nFlags, zDelta, point);
}
QUESTION : why this way to overriding the message doesn't work ?
Please can you help me in find the error ?
Thank very much
Tags for this Thread
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
|