Class

# DBKit.NumberField

<div class="rst-class">

forsearch

</div>

DBKit.NumberField

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Can display and edit the column value of the current row of the database table to which it has been assigned.

It accepts only numeric input.

Characters that are not valid in a number are rejected as the user types, and the entered value can be validated against a minimum and maximum value and formatted according to its `Type<dbkit.numberfield.type>`.

Only the members declared by <span class="title-ref">DBKit.NumberField</span> itself are described here. The members it inherits from <span class="title-ref">DBKit.TextField</span> are also listed below and are documented on the `DBKit.TextField</api/databases/dbkit/textfield>` page.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                                               | Type                                         | Read-Only | Shared |
|------------------------------------------------------------------------------------|----------------------------------------------|-----------|--------|
| `DecimalPlaces<dbkit.numberfield.decimalplaces>`                                   | `Integer</api/data_types/integer>`           |           |        |
| `DefaultValue<dbkit.numberfield.defaultvalue>`                                     | `Double</api/data_types/double>`             |           |        |
| `GreaterThanMaximumValueMessage<dbkit.numberfield.greaterthanmaximumvaluemessage>` | `String</api/data_types/string>`             |           |        |
| `LastValidationResult<dbkit.numberfield.lastvalidationresult>`                     | `Boolean</api/data_types/boolean>`           |           |        |
| `LessThanMinimumValueMessage<dbkit.numberfield.lessthanminimumvaluemessage>`       | `String</api/data_types/string>`             |           |        |
| `MaximumValue<dbkit.numberfield.maximumvalue>`                                     | `Double</api/data_types/double>`             |           |        |
| `MinimumValue<dbkit.numberfield.minimumvalue>`                                     | `Double</api/data_types/double>`             |           |        |
| `ThousandsSeparator<dbkit.numberfield.thousandsseparator>`                         | `Boolean</api/data_types/boolean>`           |           |        |
| `Type<dbkit.numberfield.type>`                                                     | `NumberTypes<dbkit.numberfield.numbertypes>` |           |        |
| `ColumnName<dbkit.textfield.columnname>`                                           | `String</api/data_types/string>`             |           |        |
| `DisplayName<dbkit.textfield.displayname>`                                         | `String</api/data_types/string>`             |           |        |
| `InvalidValueMessage<dbkit.textfield.invalidvaluemessage>`                         | `String</api/data_types/string>`             |           |        |
| `Mandatory<dbkit.textfield.mandatory>`                                             | `Boolean</api/data_types/boolean>`           |           |        |
| `Titlecase<dbkit.textfield.titlecase>`                                             | `Boolean</api/data_types/boolean>`           |           |        |
| `TrimSpaces<dbkit.textfield.trimspaces>`                                           | `Boolean</api/data_types/boolean>`           |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                     | Parameters | Returns                          | Shared |
|----------------------------------------------------------|------------|----------------------------------|--------|
| `Number<dbkit.numberfield.number>`                       |            | `Double</api/data_types/double>` |        |
| `NumericTypeFormat<dbkit.numberfield.numerictypeformat>` |            | `String</api/data_types/string>` |        |
| `TableName<dbkit.textfield.tablename>`                   |            | `String</api/data_types/string>` |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                             | Parameters                                   | Returns                          |
|--------------------------------------------------|----------------------------------------------|----------------------------------|
| `Error<dbkit.numberfield.error>`                 | theError As DBKit.Internals.NumberErrors     | `String</api/data_types/string>` |
| `NumberChanged<dbkit.numberfield.numberchanged>` |                                              |                                  |
| `RowChanged<dbkit.textfield.rowchanged>`         | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowCreated<dbkit.textfield.rowcreated>`         | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowDeleted<dbkit.textfield.rowdeleted>`         | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowEditing<dbkit.textfield.rowediting>`         | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowLoaded<dbkit.textfield.rowloaded>`           | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowNotSelected<dbkit.textfield.rownotselected>` |                                              |                                  |
| `RowSaved<dbkit.textfield.rowsaved>`             | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowSaving<dbkit.textfield.rowsaving>`           | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |
| `RowUndone<dbkit.textfield.rowundone>`           | row As `DBKit.Row</api/databases/dbkit/row>` |                                  |

## Enumerations

<div id="dbkit.numberfield.numbertypes">

<div class="rst-class">

forsearch

</div>

</div>

DBKit.NumberField.NumberTypes

### NumberTypes

> The type of number displayed by the control.
>
> | Types      |
> |------------|
> | Number     |
> | Currency   |
> | Percentage |
> | Custom     |
>
> Number displays the value as a plain number. Currency displays the value as currency. Percentage displays the value as a percentage. Custom displays the value using a custom format.

## Property descriptions

<div id="dbkit.numberfield.decimalplaces">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.DecimalPlaces

**DecimalPlaces** As `Integer</api/data_types/integer>`

> The number of decimal places displayed for the value.

<div id="dbkit.numberfield.defaultvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.DefaultValue

**DefaultValue** As `Double</api/data_types/double>`

> The default value of the field.

<div id="dbkit.numberfield.greaterthanmaximumvaluemessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.GreaterThanMaximumValueMessage

**GreaterThanMaximumValueMessage** As `String</api/data_types/string>`

> The message displayed when the value entered by the user is greater than `MaximumValue<dbkit.numberfield.maximumvalue>`. The placeholders \<\$1\> and \<\$2\> are replaced with the control's display name and the maximum value.

<div id="dbkit.numberfield.lastvalidationresult">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.LastValidationResult

**LastValidationResult** As `Boolean</api/data_types/boolean>`

> The result of the most recent validation of the field's value.

<div id="dbkit.numberfield.lessthanminimumvaluemessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.LessThanMinimumValueMessage

**LessThanMinimumValueMessage** As `String</api/data_types/string>`

> The message displayed when the value entered by the user is less than `MinimumValue<dbkit.numberfield.minimumvalue>`. The placeholders \<\$1\> and \<\$2\> are replaced with the control's display name and the minimum value.

<div id="dbkit.numberfield.maximumvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.MaximumValue

**MaximumValue** As `Double</api/data_types/double>`

> The largest value the user may enter. If `MinimumValue<dbkit.numberfield.minimumvalue>` and <span class="title-ref">MaximumValue</span> are different, values outside the range are rejected.

<div id="dbkit.numberfield.minimumvalue">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.MinimumValue

**MinimumValue** As `Double</api/data_types/double>`

> The smallest value the user may enter. If <span class="title-ref">MinimumValue</span> and `MaximumValue<dbkit.numberfield.maximumvalue>` are different, values outside the range are rejected.

<div id="dbkit.numberfield.thousandsseparator">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.ThousandsSeparator

**ThousandsSeparator** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the value is displayed with thousands separators.

<div id="dbkit.numberfield.type">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.Type

**Type** As `NumberTypes<dbkit.numberfield.numbertypes>`

> The type of number displayed by the control.

## Method descriptions

<div id="dbkit.numberfield.number">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.Number

**Number**() As `Double</api/data_types/double>`

> The numeric value of the control's text.

<div id="dbkit.numberfield.numerictypeformat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.NumericTypeFormat

**NumericTypeFormat**() As `String</api/data_types/string>`

> The format string used to display the value, derived from `Type<dbkit.numberfield.type>`, `ThousandsSeparator<dbkit.numberfield.thousandsseparator>` and `DecimalPlaces<dbkit.numberfield.decimalplaces>`.

## Event descriptions

<div id="dbkit.numberfield.error">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.Error

**Error**(*theError* As DBKit.Internals.NumberErrors) As `String</api/data_types/string>`

> The value entered by the user failed validation. *theError* indicates why: the value is less than `MinimumValue<dbkit.numberfield.minimumvalue>` or greater than `MaximumValue<dbkit.numberfield.maximumvalue>`.
>
> Implement this event to display your own error message instead of DBKit's default message. Return the message to display, or return an empty string to display no message at all. If you do not implement this event, DBKit displays a default error message.

<div id="dbkit.numberfield.numberchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

DBKit.NumberField.NumberChanged

**NumberChanged**()

> The number displayed by the control has changed.

## Notes

#### Read-only instead of disabled

When a row is displayed but not being edited, the control remains enabled but is read-only. It is only disabled when no row is selected.

#### Localization

Localize the control's user-facing text (`GreaterThanMaximumValueMessage<dbkit.numberfield.greaterthanmaximumvaluemessage>` and `LessThanMinimumValueMessage<dbkit.numberfield.lessthanminimumvaluemessage>`) the standard Xojo way: assign a dynamic constant to each property and provide translations for as many languages as you need, or localize the property values directly.

## Compatibility

|                       |         |
|-----------------------|---------|
| **Project Types**     | Desktop |
| **Operating Systems** | All     |

<div id="dbkit.numberfield.seealso">

<div class="seealso">

`DBKit.TextField</api/databases/dbkit/textfield>` parent class; `DBKit.Row</api/databases/dbkit/row>` class.

</div>

</div>
