Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 17: Track-Based Controls


ability to control this behavior is set by changing the Wrap property to True or by adding
the UDS_WRAP style. This behavior applies also if the value has been fully
decremented.

Practical Learning: Designing an UpDown control



  1. Arrange the tab sequence as follows:

  2. Click one of the spin buttons to select it. Then press and hold Ctrl. Click the other
    two spin buttons to select them, and release Ctrl

  3. On the Properties window, click the arrow of the Alignment combo box and select
    Right

  4. Check the Auto Buddy check box or set its value to True

  5. Check the Set Buddy Integer check box or set its value to True

  6. Test the application

  7. Close the dialog box and return to MSVC


17.1.4..Methods of Managing an UpDown Control...................................


We have already mentioned that a spin button is based on the CSpinButtonCtrl class.
This class is equipped with a default constructor used to declare a CSpinButtonCtrl
variable or pointer and the Create() method used to initialize the control. Here is an
example:

BOOL CSpinDlg::OnInitDialog()
{
CDialog::OnInitDialog();

// TODO: Add extra initialization here
CSpinButtonCtrl *SpinCtrl = new CSpinButtonCtrl;

SpinCtrl->Create(WS_CHILD | WS_VISIBLE | UDS_SETBUDDYINT,
CRect(60, 10, 80, 35), this, 0x128);

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
Free download pdf