How to "attach" a CScrollBar to a editbox?
-
Hi all, I just want to know what the easiest way is to have an edit box (which represents an integer, say width/height) and the arrow buttons, which upon pressing up increments the editbox value by one, and upon pressing down decrements the editbox by one? I have tried mercilessly to do this, but alas I have failed. Thanks guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Hi all, I just want to know what the easiest way is to have an edit box (which represents an integer, say width/height) and the arrow buttons, which upon pressing up increments the editbox value by one, and upon pressing down decrements the editbox by one? I have tried mercilessly to do this, but alas I have failed. Thanks guys, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
Use a CSpinButtonCtrl. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
-
Use a CSpinButtonCtrl. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
Cheers for the response. OK, I see where your going with this, but I`m still unsure as to how to link it to the edit box? I`m using a dialog box to house this control. I have so far placed the edit box and the CSpinButtonCtrl on the dialog. I have created variables for both in the dialog framework (for the CSpin a DDX control is used). Do I still have to "create" the CSpin thingy? or do I link it some other way? Many Thanks, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Cheers for the response. OK, I see where your going with this, but I`m still unsure as to how to link it to the edit box? I`m using a dialog box to house this control. I have so far placed the edit box and the CSpinButtonCtrl on the dialog. I have created variables for both in the dialog framework (for the CSpin a DDX control is used). Do I still have to "create" the CSpin thingy? or do I link it some other way? Many Thanks, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
****Chambers wrote: or do I link it some other way? Yes. Ensure that the ids of the controls are consecutive (spin control > edit control), then set the "AutoBuddy" property of the spin control in the resource editor. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
-
****Chambers wrote: or do I link it some other way? Yes. Ensure that the ids of the controls are consecutive (spin control > edit control), then set the "AutoBuddy" property of the spin control in the resource editor. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
What do I set the "Auto Buddy" too? the ID value of the edit box I presume? If this is right don`t worry about answering it, I`ll delete it if it works now. Thanks again, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
What do I set the "Auto Buddy" too? the ID value of the edit box I presume? If this is right don`t worry about answering it, I`ll delete it if it works now. Thanks again, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
What I meant was check the "AutoBuddy" property of the spin control in the resource editor. If your ids are consecutive, the spin control will automatically become the buddy of the previous edit control, which causes them to be linked. Also, you can position an autobuddy spin control anywhere in the dialog - it will be automagically rendered inside the edit control. So remember to account for the extra space when sizing the edit control. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
-
What I meant was check the "AutoBuddy" property of the spin control in the resource editor. If your ids are consecutive, the spin control will automatically become the buddy of the previous edit control, which causes them to be linked. Also, you can position an autobuddy spin control anywhere in the dialog - it will be automagically rendered inside the edit control. So remember to account for the extra space when sizing the edit control. /ravi "There is always one more bug..." ravib@ravib.com http://www.ravib.com
Right, I`ve managed to get them linked, finally. I had to enter the resource editor and swap the order of the ids around because it kept attaching to the save button i had (which is exactly what you said to do Ravi). However, the numbers go UP when i press the DOWN button, and visa versa. How do I swap them around, so that the up button makes the integer go UP, not blinking down? Cheers for your help getting me this far Ravi, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
-
Right, I`ve managed to get them linked, finally. I had to enter the resource editor and swap the order of the ids around because it kept attaching to the save button i had (which is exactly what you said to do Ravi). However, the numbers go UP when i press the DOWN button, and visa versa. How do I swap them around, so that the up button makes the integer go UP, not blinking down? Cheers for your help getting me this far Ravi, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad:
Yes, that's annoying! I suppose you could override the spin control's notifications and manually set the edit control to do the opposite. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
-
Yes, that's annoying! I suppose you could override the spin control's notifications and manually set the edit control to do the opposite. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
I found an easier way. MSDN help says that, by default, the CSpin thingy's range is set to Min:100 Max:0, and by clicking the down arrow sends the current value nearer the minimum value, which is why it goes up, its heading for 100. All I did to get it to work properly was call :
CDialog::DoDataExchange(etc.)
{
... min , max
myCSpinThingy.SetRange(0 , 10);
}and it worked no problem. Just thought I`d let you know, since I wouldn`t have got there in the end if it weren't for you, Cheers Ravi, Alan. "When I left you I was but the learner, now I am the Master" - Darth Vader:mad: