Class

DBKit.NumberField

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.

Only the members declared by DBKit.NumberField itself are described here. The members it inherits from DBKit.TextField are also listed below and are documented on the DBKit.TextField page.

Properties

Name

Type

Read-Only

DecimalPlaces

Integer

DefaultValue

Double

GreaterThanMaximumValueMessage

String

LastValidationResult

Boolean

LessThanMinimumValueMessage

String

MaximumValue

Double

MinimumValue

Double

ThousandsSeparator

Boolean

Type

NumberTypes

ColumnName

String

DisplayName

String

InvalidValueMessage

String

Mandatory

Boolean

TrimSpaces

Boolean

Methods

Name

Parameters

Returns

Number

Double

NumericTypeFormat

String

TableName

String

Events

Name

Parameters

Returns

Error

theError As DBKit.Internals.NumberErrors

String

NumberChanged

RowChanged

row As DBKit.Row

RowCreated

row As DBKit.Row

RowDeleted

row As DBKit.Row

RowEditing

row As DBKit.Row

RowLoaded

row As DBKit.Row

RowNotSelected

RowSaved

row As DBKit.Row

RowSaving

row As DBKit.Row

RowUndone

row As DBKit.Row

Enumerations

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


DBKit.NumberField.DecimalPlaces

DecimalPlaces As Integer

The number of decimal places displayed for the value.


DBKit.NumberField.DefaultValue

DefaultValue As Double

The default value of the field.


DBKit.NumberField.GreaterThanMaximumValueMessage

GreaterThanMaximumValueMessage As String

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


DBKit.NumberField.LastValidationResult

LastValidationResult As Boolean

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


DBKit.NumberField.LessThanMinimumValueMessage

LessThanMinimumValueMessage As String

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


DBKit.NumberField.MaximumValue

MaximumValue As Double

The largest value the user may enter. If MinimumValue and MaximumValue are different, values outside the range are rejected.


DBKit.NumberField.MinimumValue

MinimumValue As Double

The smallest value the user may enter. If MinimumValue and MaximumValue are different, values outside the range are rejected.


DBKit.NumberField.ThousandsSeparator

ThousandsSeparator As Boolean

If True, the value is displayed with thousands separators.


DBKit.NumberField.Type

Type As NumberTypes

The type of number displayed by the control.

Method descriptions


DBKit.NumberField.Number

Number() As Double

The numeric value of the control's text.


DBKit.NumberField.NumericTypeFormat

NumericTypeFormat() As String

The format string used to display the value, derived from Type, ThousandsSeparator and DecimalPlaces.

Event descriptions


DBKit.NumberField.Error

Error(theError As DBKit.Internals.NumberErrors) As String

The value entered by the user failed validation. theError indicates why: the value is less than MinimumValue or greater than 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.


DBKit.NumberField.NumberChanged

NumberChanged()

The number displayed by the control has changed.

Notes

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.

Localize the control's user-facing text (GreaterThanMaximumValueMessage and 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

See also

DBKit.TextField parent class; DBKit.Row class.