Class

DBKit.PopupMenu

DBKit.PopupMenu


Description

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

It displays the column value in a popup menu.

The menu can populate itself from a database table when the control opens. If AutoPopulateTableName and AutoPopulateColumnName are set, the menu fills with the values of that column, and the selected value (or its primary key, depending on AutoPopulateStorageType) is stored in the row.

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

Properties

Name

Type

Read-Only

Shared

AutoPopulateColumnName

String

AutoPopulateStorageType

StorageTypes

AutoPopulateTableName

String

ColumnName

String

DefaultRowIndex

Integer

DisplayName

String

InvalidValueMessage

String

Mandatory

Boolean

ValueNotFoundMessage

String

Methods

Name

Parameters

Returns

Shared

TableName

String

Events

Name

Parameters

Returns

Error

String

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.PopupMenu.StorageTypes

StorageTypes

How the selected menu value is stored in the database.

Types

ColumnValue

PrimaryKey

ColumnValue stores the selected menu item's text in the database column. PrimaryKey stores the primary key of the selected row, which is kept in the menu item's row tag, in the database column.

Property descriptions


DBKit.PopupMenu.AutoPopulateColumnName

AutoPopulateColumnName As String

The name of the database column whose values fill the menu when the control populates itself. If blank, ColumnName is used.


DBKit.PopupMenu.AutoPopulateStorageType

AutoPopulateStorageType As StorageTypes

Whether the menu stores the selected item's text or its primary key in the database column.


DBKit.PopupMenu.AutoPopulateTableName

AutoPopulateTableName As String

The name of the database table the menu populates itself from when the control opens. If blank, the control's table is used.


DBKit.PopupMenu.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.


DBKit.PopupMenu.DefaultRowIndex

DefaultRowIndex As Integer

The index of the menu row that is selected when a new row is created.


DBKit.PopupMenu.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).


DBKit.PopupMenu.InvalidValueMessage

InvalidValueMessage As String

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

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


DBKit.PopupMenu.Mandatory

Mandatory As Boolean

If True, the user must make a selection before the row can be saved. When a row with no selection in a mandatory control is saved, the InvalidValueMessage is displayed and the save is cancelled.


DBKit.PopupMenu.ValueNotFoundMessage

ValueNotFoundMessage As String

The message displayed when the current row's value cannot be found in the menu. Use <$1> as a placeholder for the control's display name and <$2> for the value that was not found.

The default is "The value <$1> could not be found in the list."

Method descriptions


DBKit.PopupMenu.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.PopupMenu.Error

Error() As String

A DatabaseException occurred when the control attempted to auto-populate itself from a database table.

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.PopupMenu.RowChanged

RowChanged(row As DBKit.Row)

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


DBKit.PopupMenu.RowCreated

RowCreated(row As DBKit.Row)

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


DBKit.PopupMenu.RowDeleted

RowDeleted(row As DBKit.Row)

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


DBKit.PopupMenu.RowEditing

RowEditing(row As DBKit.Row)

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


DBKit.PopupMenu.RowLoaded

RowLoaded(row As DBKit.Row)

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


DBKit.PopupMenu.RowNotSelected

RowNotSelected

There is no row currently selected.


DBKit.PopupMenu.RowSaved

RowSaved(row As DBKit.Row)

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


DBKit.PopupMenu.RowSaving

RowSaving(row As DBKit.Row)

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


DBKit.PopupMenu.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 and ValueNotFoundMessage) 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

DesktopPopupMenu parent class; DBKit.Row class.