Share via


Using CSpinButtonCtrl

The spin button control (also called an up-down control) provides a pair of arrows that the user can click to adjust a value. This value is called the current position. The position stays within the range of the spin button. When the user clicks the up arrow, the position moves toward the maximum; and when the user clicks the down arrow, the position moves toward the minimum.

The spin button control is represented in MFC by class CSpinButtonCtrl.

When you click a spin button control, the control sends a WM_VSCROLL message to the parent window by default. If the control layout is horizontal instead of vertical, the control sends a WM_HSCROLL message to the parent window.

Note

The default range for the spin button has the maximum set to zero (0) and the minimum set to 100. Since the maximum value is less than the minimum value, clicking the up arrow will decrease the position and clicking the down arrow will increase it. Use CSpinButtonCtrl::SetRange to adjust these values.

Typically, the current position is displayed in a companion control. The companion control is called the "buddy window." For an illustration of a spin button control, see About Up-Down Controls in the Windows SDK.

What do you want to know more about?

See Also

Concepts

Controls (MFC)

Change History

Date

History

Reason

May 2009

Added information regarding WM_VSCROLL and WM_HSCROLL messages.

Information enhancement.