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 below.
Pop-Up Calculator Control |
---|
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:
- CurrencyCellType (see Setting a Currency Cell)
- NumberCellType (see Setting a Number Cell)
- PercentCellType (see Setting a Percent Cell)
When using the controls, only clicking on the OK or Cancel buttons closes 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. 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
- Define the cell by creating an instance of the CurrencyCellType class (or other number type cell).
- Specify the text for the buttons.
- Assign the cell type to a cell or range of cells by setting the CellType property for a cell, column, row, or style.
Example
Set the text of the buttons.
C# | Copy Code |
---|---|
FFarPoint.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 |