Hai All
I am developing a MFC based SDI VC++ application. In my application I need to specify negative range value for my Slider Control. The minimum range for the Slider is -40 and maximum range is 255. I tried it using SetRange function. But it is not working. How can I set this range in the slider?Please Help..
My code for the Slider is as follows: Slider is declared as
CSliderCtrl m_ctrlECTSlider;
OnInitialUpdate function contains
m_ctrlECTSlider.SetRangeMin(-40);
int iValMin = m_ctrlECTSlider.GetRangeMin();
m_ctrlECTSlider.SetRangeMax(255);
int iValMax = m_ctrlECTSlider.GetRangeMax();
m_ctrlECTSlider.SetPos(0);
SetDlgItemInt( IDC_ECT_VALUE, m_ctrlECTSlider.GetPos(), FALSE);
SetDlgItemInt( IDC_MIN_ECT, iValMin, FALSE);
SetDlgItemInt( IDC_MAX_ECT, iValMax, FALSE);
OnBnClickedSet function contains
int nMin = GetDlgItemInt(IDC_MIN_ECT, 0, FALSE);
int nMax = GetDlgItemInt(IDC_MAX_ECT, 0, FALSE);
m_ctrlECTSlider.SetRange(nMin, nMax);
m_ctrlECTSlider.SetPos(nMin);
int pos = m_ctrlECTSlider.GetPos();
SetDlgItemInt(IDC_ECT_VALUE, m_ctrlECTSlider.GetPos(), FALSE);
m_ctrlECTSlider.RedrawWindow();
Here the problem is the value returned during debugg is all correct. But when it comes to UI on running the min value is 429496 and not -40 in the edit box..Why is it so..I am developing SDI application using CFormView class..
Thanks in advance.