Class

# DBKit.PopupMenu

<div class="rst-class">

forsearch

</div>

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<dbkit.popupmenu.autopopulatetablename>` and `AutoPopulateColumnName<dbkit.popupmenu.autopopulatecolumnname>` are set, the menu fills with the values of that column, and the selected value (or its primary key, depending on `AutoPopulateStorageType<dbkit.popupmenu.autopopulatestoragetype>`) is stored in the row.

Only the members declared by <span class="title-ref">DBKit.PopupMenu</span> itself are described here; for the inherited members, see `the parent class<dbkit.popupmenu.seealso>`.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                               | Type                                         | Read-Only | Shared |
|--------------------------------------------------------------------|----------------------------------------------|-----------|--------|
| `AutoPopulateColumnName<dbkit.popupmenu.autopopulatecolumnname>`   | `String</api/data_types/string>`             |           |        |
| `AutoPopulateStorageType<dbkit.popupmenu.autopopulatestoragetype>` | `StorageTypes<dbkit.popupmenu.storagetypes>` |           |        |
| `AutoPopulateTableName<dbkit.popupmenu.autopopulatetablename>`     | `String</api/data_types/string>`             |           |        |
| `ColumnName<dbkit.popupmenu.columnname>`                           | `String</api/data_types/string>`             |           |        |
| `DefaultRowIndex<dbkit.popupmenu.defaultrowindex>`                 | `Integer</api/data_types/integer>`           |           |        |
| `DisplayName<dbkit.popupmenu.displayname>`                         | `String</api/data_types/string>`             |           |        |
| `InvalidValueMessage<dbkit.popupmenu.invalidvaluemessage>`         | `String</api/data_types/string>`             |           |        |
| `Mandatory<dbkit.popupmenu.mandatory>`                             | `Boolean</api/data_types/boolean>`           |           |        |
| `ValueNotFoundMessage<dbkit.popupmenu.valuenotfoundmessage>`       | `String</api/data_types/string>`             |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                   | Parameters | Returns                          | Shared |
|----------------------------------------|------------|----------------------------------|--------|
| `TableName<dbkit.popupmenu.tablename>` |            | `String</api/data_types/string>` |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

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

## Enumerations

<div id="dbkit.popupmenu.storagetypes">

<div class="rst-class">

forsearch

</div>

</div>

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

<div id="dbkit.popupmenu.autopopulatecolumnname">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.AutoPopulateColumnName

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

> The name of the database column whose values fill the menu when the control populates itself. If blank, `ColumnName<dbkit.popupmenu.columnname>` is used.

<div id="dbkit.popupmenu.autopopulatestoragetype">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.AutoPopulateStorageType

**AutoPopulateStorageType** As `StorageTypes<dbkit.popupmenu.storagetypes>`

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

<div id="dbkit.popupmenu.autopopulatetablename">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.AutoPopulateTableName

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

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

<div id="dbkit.popupmenu.columnname">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.ColumnName

**ColumnName** As `String</api/data_types/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.

<div id="dbkit.popupmenu.defaultrowindex">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.DefaultRowIndex

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

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

<div id="dbkit.popupmenu.displayname">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.DisplayName

**DisplayName** As `String</api/data_types/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>`).

<div id="dbkit.popupmenu.invalidvaluemessage">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.InvalidValueMessage

**InvalidValueMessage** As `String</api/data_types/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."

<div id="dbkit.popupmenu.mandatory">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.Mandatory

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

> If `True</api/language/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<dbkit.popupmenu.invalidvaluemessage>` is displayed and the save is cancelled.

<div id="dbkit.popupmenu.valuenotfoundmessage">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.ValueNotFoundMessage

**ValueNotFoundMessage** As `String</api/data_types/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

<div id="dbkit.popupmenu.tablename">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.TableName

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

> Returns the name of the database table the control's column belongs to. If the `ColumnName<dbkit.popupmenu.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

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

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.Error

**Error**() As `String</api/data_types/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.

<div id="dbkit.popupmenu.rowchanged">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowChanged

**RowChanged**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rowcreated">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowCreated

**RowCreated**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rowdeleted">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowDeleted

**RowDeleted**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rowediting">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowEditing

**RowEditing**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rowloaded">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowLoaded

**RowLoaded**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rownotselected">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowNotSelected

**RowNotSelected**

> There is no row currently selected.

<div id="dbkit.popupmenu.rowsaved">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowSaved

**RowSaved**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rowsaving">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowSaving

**RowSaving**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

<div id="dbkit.popupmenu.rowundone">

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

</div>

<div class="rst-class">

forsearch

</div>

DBKit.PopupMenu.RowUndone

**RowUndone**(row As `DBKit.Row</api/databases/dbkit/row>`)

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

## Notes

#### Localization

Localize the control's user-facing text (`InvalidValueMessage<dbkit.popupmenu.invalidvaluemessage>` and `ValueNotFoundMessage<dbkit.popupmenu.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     |

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

<div class="seealso">

`DesktopPopupMenu</api/user_interface/desktop/desktoppopupmenu>` parent class; `DBKit.Row</api/databases/dbkit/row>` class.

</div>

</div>
