Class

DBKit.TextField

DBKit.TextField


Description

Displays and edits the value of a single database column for the current row.

Set ColumnName to the column you want the field bound to. When the current row changes, the field shows the column's value; when the user edits the field, the new value is written back to the row automatically.

Only the members declared by DBKit.TextField itself are described here; for the inherited members, see the parent classes.

Properties

Name

Type

Read-Only

ColumnName

String

DisplayName

String

InvalidValueMessage

String

Mandatory

Boolean

TextCase

TextCases

TrimSpaces

Boolean

Methods

Name

Parameters

Returns

TableName

String

Events

Name

Parameters

Returns

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.TextField.TextCases

TextCases

The text case conversions available for the TextCase property.

Types

Description

None

Applies no case conversion.

Lowercase

Converts the text to lowercase as it is typed.

Titlecase

Converts the text to title case as it is typed.

Uppercase

Converts the text to uppercase as it is typed.

Property descriptions


DBKit.TextField.ColumnName

ColumnName As String

The name of the database column whose value this control displays and edits.

If blank, the control's name is used as the column name. The name may be qualified with a table name (for example "tablename.columnname") when the control shows a column from a related table.

Tip

Instead of setting this property, you can name the control the same as the database column. DBKit first looks at the ColumnName property; if it is blank, it then uses the name of the control itself.


DBKit.TextField.DisplayName

DisplayName As String

A user-friendly name for the control, shown to the user in place of the column name (for example in the InvalidValueMessage).

If blank, the column name is de-camelcased automatically (for example "FirstName" becomes "First Name").


DBKit.TextField.InvalidValueMessage

InvalidValueMessage As String

The message displayed when the field is mandatory but has no value. Use <$1> as a placeholder for the control's display name.

The default is "<$1> must have a value."


DBKit.TextField.Mandatory

Mandatory As Boolean

If True, the field must contain a value before the row can be saved. When a row with an empty mandatory field is saved, the InvalidValueMessage is displayed and the save is cancelled.

The default is False.


DBKit.TextField.TextCase

TextCase As TextCases

The case conversion applied to the text as it is typed.

The default is TextCases.None.


DBKit.TextField.TrimSpaces

TrimSpaces As Boolean

If True, leading and trailing spaces are removed from the text when the control loses focus.

The default is True.

Method descriptions


DBKit.TextField.TableName

TableName() As String

Returns the name of the database table the control's column belongs to. If the ColumnName is qualified with a table name (for example "tablename.columnname"), that table name is returned; otherwise the table is resolved from the control's layout.

Event descriptions


DBKit.TextField.RowChanged

RowChanged(row As DBKit.Row)

The current row (passed to the event) has been changed.


DBKit.TextField.RowCreated

RowCreated(row As DBKit.Row)

A new row (passed to the event) was just created and is now the current row.


DBKit.TextField.RowDeleted

RowDeleted(row As DBKit.Row)

The current row (passed to the event) has been deleted.


DBKit.TextField.RowEditing

RowEditing(row As DBKit.Row)

The current row (passed to the event) is being edited by the user.


DBKit.TextField.RowLoaded

RowLoaded(row As DBKit.Row)

The current row (passed to the event) has been loaded.


DBKit.TextField.RowNotSelected

RowNotSelected

There is no row currently selected.


DBKit.TextField.RowSaved

RowSaved(row As DBKit.Row)

The current row (passed to the event) has been saved.


DBKit.TextField.RowSaving

RowSaving(row As DBKit.Row)

The current row (passed to this event) is about to be saved.


DBKit.TextField.RowUndone

RowUndone(row As DBKit.Row)

The changes made to the current row (passed to this event) have been undone.

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.

Automatic hints

If the layout's AutomaticHints property (Window, Page, Container) is True (the default) and the control's Hint is empty, the Hint is set to the control's display name when the control opens. The display name is the DisplayName property if set, otherwise the column name with camel-case words split apart, so LastName is shown as "Last Name".

Localization

Localize the control's user-facing text (InvalidValueMessage) 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, Web

Operating Systems

All

See also

DesktopTextField (desktop) and WebTextField (web) parent classes; DBKit.Row class.