![]() |
MFC ActiveX Controls - UpDown |
|
|
Using an UpDown Control |
|
To provide an updown control to your application, display the Insert ActiveX Control dialo box, select Microsoft UpDown Control 6.0 and click OK. If you plan to refer to the control in your code, you can add a variable for it. When you do this, Visual C++ would create and even implement its class, giving all of its code (its header and source files). You can then find out that the updown control is based on the CUpDown class which itself is based on CWnd, making it convinient to use CWnd properties and methods. void CDlgSpin::OnConfigureUpDown()
{
// TODO: Add your control notification handler code here
m_UpDown.SetMin(12);
m_UpDown.SetMax(250);
}
To get the minimum value of an updown control, call the GetMin() method. To get the maximum value of an updown control, call the GetMax() method. void CDlgSpin:: OnConfigureUpDown()
{
// TODO: Add your control notification handler code here
m_UpDown.SetMin(12);
m_UpDown.SetMax(250);
m_UpDown.SetValue(88);
}
To get the value of an updown control, call its GetValue() method.
![]() To programmatically set an incremental value, call the SetIncrement() method. Here is an example: void CDlgSpin:: OnConfigureUpDown()
{
// TODO: Add your control notification handler code here
m_UpDown.SetMin(12);
m_UpDown.SetMax(250);
m_UpDown.SetValue(88);
m_UpDown.SetIncrement(5);
}
|
|
|
The UpDown Control Events |
|
The updown control makes an object distinction between its button components. For example, when the user clicks the up pointing arrow button, the control fires the UpClick() event. On the other hand, when the user clicks the down pointing arrow button, the control sends a DownClick() event. These allow you to treat each event separately if you want.
|
|
|
| Copyright © 2003-2005 FunctionX, Inc. |
|
|