Monday, August 06, 2007

Slider Control

1.Today I worked with slider control with horizontal attribute
change it as to horizontal and in order to receive the slider control messages we have to add the
HSCROLL or VSCROLL message

I added the following message :

ON_WM_HSCROLL() added it within BEGIN_MESSAGE () macro.

next I added the fn like

afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) ;

while using Slider control, the SCROLL message is posted...
There are two main notification codes are available.

That are
TB_THUMBTRACK //Slider movement (the user dragged the slider)
TB_THUMBPOSITION//WM_LBUTTONUP following a TB_THUMBTRACK notification message


void MFCDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CSliderCtrl * pControl = (CSliderCtrl*) pScrollBar);

switch(nSBCode)
{
case TB_THUMBTRACK://Slider movement (the user dragged the slider)
{
break;
}
case TB_THUMBPOSITION:
{
//WM_LBUTTONUP following a TB_THUMBTRACK notification message
//StopTimer();
break;
}

}


}

Labels: ,

0 Comments:

Post a Comment

<< Home