Spread Windows Forms 12.0 Product Documentation
Customizing the Pop-Up Calculator Control
Spread Windows Forms 12.0 Product Documentation > Developer's Guide > Customizing Interaction with Cell Types > Understanding Additional Features of Cell Types > Customizing the Pop-Up Calculator Control

If the user presses F4 or double-clicks any of the several numeric cell types when the cell is in edit mode, a pop-up calculator appears, as shown in the following figure.

Pop-up Calculator

You can use the calculator to type a number or to perform a calculation. The result from the calculator is placed in the numeric cell. The cell types that allow a calculator pop-up are:

When using the controls, you must click the OK or Cancel button to close the control. You can change the text of the buttons at the bottom with the SetCalculatorText method for that cell type.

Note that the text appears centered on the button. If you set custom text for the buttons, try to limit your text to eight or nine characters in length. The button will display ten characters, but the first and last appear very close to the edges of the button.

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

  1. Define the cell by creating an instance of the CurrencyCellType class (or other numeric type cell).
  2. Specify the text for the buttons.
  3. Assign the cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style.

Example

This example sets the text of the buttons.

C#
Copy Code
FarPoint.Win.Spread.CellType.CurrencyCellType ctest = new FarPoint.Win.Spread.CellType.CurrencyCellType();
ctest.SetCalculatorText("Accept", "Cancel");
fpSpread1.Sheets[0].Cells[0, 0].CellType = ctest;
VB
Copy Code
Dim ctest As New FarPoint.Win.Spread.CellType.CurrencyCellType()
ctest.SetCalculatorText("Accept", "Cancel")
fpSpread1.Sheets(0).Cells(0, 0).CellType = ctest