Class

DBKit.DateTimeLabel

DBKit.DateTimeLabel


Description

Displays the value of a single database column for the current row as a formatted date and time.

Set ColumnName to the column you want the label bound to. When the current row changes, the label shows the column's date and time value, formatted using the CustomFormat, DateFormat and TimeFormat properties.

Only the members declared by DBKit.DateTimeLabel and those inherited from DBKit.Label are described here; for the remaining inherited members, see DesktopLabel (desktop) and WebLabel (web).

Properties

Name

Type

Read-Only

ColumnName

String

CustomFormat

String

DateFormat

DateTimeFormats

DefaultToNow

Boolean

DisplayName

String

FourDigitYear

Boolean

InvalidValueMessage

String

Mandatory

Boolean

TimeFormat

DateTimeFormats

Value

DateTime

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.DateTimeLabel.DateTimeFormats

DateTimeFormats

Specifies the format of the date or time portion of the displayed value when CustomFormat is blank. Each value corresponds to the same-named value of DateTime.FormatStyles.

Formats

None

Short

Medium

Long

Full

None omits the date or time portion entirely.

Property descriptions


DBKit.DateTimeLabel.ColumnName

ColumnName As String

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

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.DateTimeLabel.CustomFormat

CustomFormat As String

A custom format string used to display the value. The string is passed to DateTime.ToString with the current locale.

If blank, the value is displayed using the DateFormat and TimeFormat properties instead.


DBKit.DateTimeLabel.DateFormat

DateFormat As DateTimeFormats

The format used for the date portion of the displayed value when CustomFormat is blank.

The default is DateTimeFormats.None.


DBKit.DateTimeLabel.DefaultToNow

DefaultToNow As Boolean

If True, the Value is set to the current date and time when a new row is created.

The default is False.


DBKit.DateTimeLabel.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.DateTimeLabel.FourDigitYear

FourDigitYear As Boolean

If True, the year is displayed using four digits.

The default is True.


DBKit.DateTimeLabel.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.DateTimeLabel.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.DateTimeLabel.TimeFormat

TimeFormat As DateTimeFormats

The format used for the time portion of the displayed value when CustomFormat is blank.

The default is DateTimeFormats.None.


DBKit.DateTimeLabel.Value

Value As DateTime

The date and time value displayed by the control.

Setting Value updates the displayed text: if CustomFormat is set, it determines the display; otherwise the DateFormat and TimeFormat properties do. Assigning Nil is ignored.

Method descriptions


DBKit.DateTimeLabel.TableName

TableName() As String

Returns the name of the database table the control's column belongs to, resolved from the control's layout.

Event descriptions


DBKit.DateTimeLabel.RowChanged

RowChanged(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowCreated

RowCreated(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowDeleted

RowDeleted(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowEditing

RowEditing(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowLoaded

RowLoaded(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowNotSelected

RowNotSelected

There is no row currently selected.


DBKit.DateTimeLabel.RowSaved

RowSaved(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowSaving

RowSaving(row As DBKit.Row)

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


DBKit.DateTimeLabel.RowUndone

RowUndone(row As DBKit.Row)

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

Notes

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

DBKit.Label parent class; DBKit.Row class.