Spread Windows Forms 11.0 Product Documentation
Displaying Spin Buttons
Spread Windows Forms 11.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Understanding Additional Features of Cell Types > Displaying Spin Buttons

In some cell types, you can display spin buttons, to let users change the value in a cell quickly. Spin buttons are a set of two arrow buttons that appear together, one for increasing the value and one for decreasing the value. Spin buttons appear when the cell is in edit mode. The following figure illustrates spin buttons on the right-hand side of a number cell.

Spin Buttons in a Number Cell

You specify how much the value changes when the user clicks a spin button and you determine whether the value wraps when the minimum or maximum value is reached.

Spin buttons can be displayed in:

For the numeric cell types, if the cursor is left of the decimal point, by default the spin button increments the value using the whole number. If the cursor is to the right, by default the spin button increments the value using the first, or tenths, decimal place.

For the date-time cell type, the day, month, year, etc. are incremented or decremented depending on which part of the date and time the cursor is in.

The spin buttons expand vertically to fill the entire height of the cell, so the taller the cell, the bigger the spin buttons. The properties of the currency, number, and percent cell types that relate to spin buttons are listed in the following table. The date-time cell type only provides the SpinButton property.

Property Description
SpinButton Sets whether a spin button is displayed when editing.
SpinDecimalIncrement Sets the amount by which the value increments when using the spin buttons and the cursor is in the decimal portion.
SpinIntegerIncrement Sets the amount by which the value increments when using the spin buttons and the cursor is in the integer portion.
SpinWrap Sets whether the value wraps when the minimum or maximum is reached.

For more information refer to the property for each cell type:

For information on the editable cell types, refer to Working with Editable Cell Types.

For information on other features of cell types, refer to Understanding Additional Features of Cell Types.

Using Code

Example

This example specifies a currency cell and sets spin button properties.

C#
Copy Code
FarPoint.Win.Spread.CellType.CurrencyCellType crcycell = new FarPoint.Win.Spread.CellType.CurrencyCellType();
crcycell.SpinButton = true;
crcycell.SpinDecimalIncrement = 0.5F;
crcycell.SpinIntegerIncrement = 5;
crcycell.SpinWrap = true;
crcycell.MaximumValue = 500;
crcycell.MinimumValue = -100;
fpSpread1.Sheets[0].Cells[6,2].CellType = crcycell;
fpSpread1.Sheets[0].Cells[6,2].Value = 443.3482;
VB
Copy Code
Dim curr As New FarPoint.Win.Spread.CellType.CurrencyCellType()
curr.SpinButton = True
curr.SpinDecimalIncrement = 0.5
curr.SpinIntegerIncrement = 5
curr.SpinWrap = True
curr.MaximumValue = 500
curr.MinimumValue = -100
fpSpread1.ActiveSheet.Cells(0, 0).CellType = curr
fpSpread1.ActiveSheet.Cells(0, 0).Value = 443.3482

Using the Spread Designer

  1. Select the cell or cells in the work area.
  2. In the property list, in the Misc category, select CellType. From the drop-down list, choose the cell type. Now expand the CellType property and various properties are available that are specific to this cell type. Set SpinButton to True to display the spin buttons. Select and set other properties as needed.

    Or right-click on the cell or cells and select Cell Type. From the list, select the cell type. In the CellType editor, set the properties you need. Click Apply.

  3. From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.