Spint control
-
hi, I want write a sample application,having two edit boxes and one spincontrol.The spin control is set as buddy to the first editbox.I want to the setrange as 0 to 200.In the second edit box i want to enter data,the steps of increment tha has to be done in,first edidbox when click in spin control...Pls can any help how to address this..issue.. thanks in before james....
-
hi, I want write a sample application,having two edit boxes and one spincontrol.The spin control is set as buddy to the first editbox.I want to the setrange as 0 to 200.In the second edit box i want to enter data,the steps of increment tha has to be done in,first edidbox when click in spin control...Pls can any help how to address this..issue.. thanks in before james....
RockyJames wrote:
I want to the setrange as 0 to 200
Use CSpinButtonCtrl::SetRange(short nLower,short nUpper);
RockyJames wrote:
the steps of increment tha has to be done in,first edidbox when click in spin control.
Take the text from the second edit box and convert it to integer value. Now you can use CSpinButtonCtrl::SetPos(int nPos); for Spin control.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
RockyJames wrote:
I want to the setrange as 0 to 200
Use CSpinButtonCtrl::SetRange(short nLower,short nUpper);
RockyJames wrote:
the steps of increment tha has to be done in,first edidbox when click in spin control.
Take the text from the second edit box and convert it to integer value. Now you can use CSpinButtonCtrl::SetPos(int nPos); for Spin control.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
yeah i did this...i want to handle..(UDN_DELTAPOS)OnDeltaposSpin...of the spin control..Say for example the initial value in editbox one is 0 and the initial value in editbox two is 10..when the click the spincontrol.the value in first editbox has to updated based on the interval specified in second editbox..here..0 ,10 ,20 ,30 etc..how to do it..? thanks in before..
-
yeah i did this...i want to handle..(UDN_DELTAPOS)OnDeltaposSpin...of the spin control..Say for example the initial value in editbox one is 0 and the initial value in editbox two is 10..when the click the spincontrol.the value in first editbox has to updated based on the interval specified in second editbox..here..0 ,10 ,20 ,30 etc..how to do it..? thanks in before..
RockyJames wrote:
value in first editbox has to updated based on the interval specified in second editbox.
void CYourDlg::OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult) { LPNMUPDOWN pNMUpDown = reinterpret_cast(pNMHDR); if(m_strEdit2.GetWindowTextLength()>0) //add this if condition { CString s; m_strEdit1.GetWindowText (s); int i=atoi(s); CString t; m_strEdit2 .GetWindowText (t); int j=atoi(t); pNMUpDown ->iDelta =j; CString u;u.Format ("%d",i+j); m_st rEdit1.SetWindowText (u); } else // Add this block { CString x; x.Format ("%d",pNMUpDown ->iPos ); m_strEdit1.SetWindowText (x); } *pResult = 0; }
In On InitDialog of your dialog you can put:
CWnd *wnd=GetWindow (IDC_EDIT1); m_Spin.SetBuddy (wnd); m_Spin.SetRange (0,200); m_strEdit1.SetWindowText ("0");
Let me know if this suits your needs now or even if there does exist some problem just inform me back... -- modified at 2:15 Saturday 23rd September, 2006
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
RockyJames wrote:
value in first editbox has to updated based on the interval specified in second editbox.
void CYourDlg::OnDeltaposSpin1(NMHDR *pNMHDR, LRESULT *pResult) { LPNMUPDOWN pNMUpDown = reinterpret_cast(pNMHDR); if(m_strEdit2.GetWindowTextLength()>0) //add this if condition { CString s; m_strEdit1.GetWindowText (s); int i=atoi(s); CString t; m_strEdit2 .GetWindowText (t); int j=atoi(t); pNMUpDown ->iDelta =j; CString u;u.Format ("%d",i+j); m_st rEdit1.SetWindowText (u); } else // Add this block { CString x; x.Format ("%d",pNMUpDown ->iPos ); m_strEdit1.SetWindowText (x); } *pResult = 0; }
In On InitDialog of your dialog you can put:
CWnd *wnd=GetWindow (IDC_EDIT1); m_Spin.SetBuddy (wnd); m_Spin.SetRange (0,200); m_strEdit1.SetWindowText ("0");
Let me know if this suits your needs now or even if there does exist some problem just inform me back... -- modified at 2:15 Saturday 23rd September, 2006
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
When i click..up arrow of the..spincontrol value has tobe increased and when i click down arrown value has to be decreased in first edit box,but there in both cases..value is increased...
-
When i click..up arrow of the..spincontrol value has tobe increased and when i click down arrown value has to be decreased in first edit box,but there in both cases..value is increased...
Put m_strEdit2.SetWindowText("1"); in On Init dialog. In OnDeltaPos.... add these lines.
UDACCEL updown; CString t; m_strEdit2 .GetWindowText (t); int j=atoi(t); updown.nInc =j; updown.nSec =1; m_Spin.SetAccel (1,&updown); CString str; str.Format ("%d",pNMUpDown ->iPos ); m_strEdit1.SetWindowText (str);
I haven't tested the code...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Put m_strEdit2.SetWindowText("1"); in On Init dialog. In OnDeltaPos.... add these lines.
UDACCEL updown; CString t; m_strEdit2 .GetWindowText (t); int j=atoi(t); updown.nInc =j; updown.nSec =1; m_Spin.SetAccel (1,&updown); CString str; str.Format ("%d",pNMUpDown ->iPos ); m_strEdit1.SetWindowText (str);
I haven't tested the code...
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
still it is not working properly..frined..
-
still it is not working properly..frined..
What do you want,exactly? You have two editboxs and a spin control that it sets to 0..200 then?
_**
**_
WhiteSky