Skip to main content

TcxSpinButton Class

Represents the spin button.

Declaration

TcxSpinButton = class(
    TcxCustomSpinButton
)

Remarks

The TcxSpinButton class represents the spin button control. A spin button can be connected to a TWinControl to enable editing of the control’s value and for performing navigation using the keyboard or the spin buttons. Use the Associate property to bind a spin button to a control. The spin button is located at the right edge of the associated control (see the image below).

If a spin button is associated with an edit control, then the edit control’s value is obtained from the spin button’s Value property (0 by default). When the edit control has focus, the associated spin button handles pressing the Up, Down, PageUp and PageDown keys. Pressing the Up key or the right/up spin button increases the edit control’s value while pressing the Down key or the left/down spin button decreases it (increment/decrement is specified by the Properties.Increment property).

Spin buttons also provide fast navigation through the edit control’s values. Fast navigation is performed when a user presses a fast button or a PageUp/PageDown key. In order to enable fast buttons, set the Properties.SpinButtons.ShowFastButtons property to True. During fast navigation, the edit control value is increased/decreased by the Properties.LargeIncrement property value.

The following screenshot shows a spin button bound to a cxComboBox control. The Properties.SpinButtons.ShowFastButtons property value is True and the Properties.SpinButtons.Position property is set to sbpHorzRight:

Note that the most obvious application of the spin button control is to bind it to a text editor. This will allow end-users to edit the value directly or by pressing the increment/decrement and fast navigation buttons. However, this functionality is already better implemented by the TcxSpinEdit control. Use the spin button control for associating with other controls, not the basic text editor.

Also, you should connect a spin button to edit controls in order to obtain full functionality. If you bind a spin button to another type of control, then you need to handle changes to its Value manually (by using the Properties.OnEditValueChanged event handler).

See Also