Compartilhar via


CSpinButtonCtrl Class

Provides the functionality of the Windows common spin button control.

class CSpinButtonCtrl : public CWnd

Members

Public Constructors

Name

Description

CSpinButtonCtrl::CSpinButtonCtrl

Constructs a CSpinButtonCtrl object.

Public Methods

Name

Description

CSpinButtonCtrl::Create

Creates a spin button control and attaches it to a CSpinButtonCtrl object.

CSpinButtonCtrl::CreateEx

Creates a spin button control with the specified Windows extended styles and attaches it to a CSpinButtonCtrl object.

CSpinButtonCtrl::GetAccel

Retrieves acceleration information for a spin button control.

CSpinButtonCtrl::GetBase

Retrieves the current base for a spin button control.

CSpinButtonCtrl::GetBuddy

Retrieves a pointer to the current buddy window.

CSpinButtonCtrl::GetPos

Retrieves the current position of a spin button control.

CSpinButtonCtrl::GetRange

Retrieves the upper and lower limits (range) for a spin button control.

CSpinButtonCtrl::SetAccel

Sets the acceleration for a spin button control.

CSpinButtonCtrl::SetBase

Sets the base for a spin button control.

CSpinButtonCtrl::SetBuddy

Sets the buddy window for a spin button control.

CSpinButtonCtrl::SetPos

Sets the current position for the control.

CSpinButtonCtrl::SetRange

Sets the upper and lower limits (range) for a spin button control.

Remarks

A "spin button control" (also known as an up-down control) is a pair of arrow buttons that the user can click to increment or decrement a value, such as a scroll position or a number displayed in a companion control. The value associated with a spin button control is called its current position. A spin button control is most often used with a companion control, called a "buddy window."

This control (and therefore the CSpinButtonCtrl class) is available only to programs running under Windows 95/98 and Windows NT version 3.51 and later.

To the user, a spin button control and its buddy window often look like a single control. You can specify that a spin button control automatically position itself next to its buddy window, and that it automatically set the caption of the buddy window to its current position. You can use a spin button control with an edit control to prompt the user for numeric input.

Clicking the up arrow moves the current position toward the maximum, and clicking the down arrow moves the current position toward the minimum. By default, the minimum is 100 and the maximum is 0. Any time the minimum setting is greater than the maximum setting (for example, when the default settings are used), clicking the up arrow decreases the position value and clicking the down arrow increases it.

A spin button control without a buddy window functions as a sort of simplified scroll bar. For example, a tab control sometimes displays a spin button control to enable the user to scroll additional tabs into view.

For more information on using CSpinButtonCtrl, see Controls and Using CSpinButtonCtrl.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CSpinButtonCtrl

Requirements

Header: afxcmn.h

See Also

Reference

CWnd Class

Hierarchy Chart

CSliderCtrl Class

Concepts

MFC Sample CMNCTRL2