Class

DBKit.Container

DBKit.Container


Description

Used to display other DBKit controls with data from the current row of a database table to which it's assigned.

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

Properties

Name

Type

Read-Only

AutomaticHints

Boolean

ConfirmCancelButtonCaption

String

ConfirmContinueButtonCaption

String

CurrentRow

DBKit.Row

Database

Database

DeleteConfirmExplanation

String

DeleteConfirmMessage

String

DeleteConfirmTitle

String

OrderBy

String

SelectedRowIndex

Integer

TableName

String

TableRelationships

String

UnsavedChangesExplanation

String

UnsavedChangesMessage

String

UnsavedChangesTitle

String

Where

String

Methods

Name

Parameters

Returns

Close

Constructor

theRowsSource As DBKit.SDK.RowsListControl, createNewRow As Boolean

Events

Name

Parameters

Returns

Error

error As RuntimeException

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

Property descriptions


DBKit.Container.AutomaticHints

AutomaticHints As Boolean

Whether the controls on this container automatically set their Hint from the database column's display name when no Hint is set.

The default is True.


DBKit.Container.ConfirmCancelButtonCaption

ConfirmCancelButtonCaption As String

The caption of the Cancel button in the unsaved-changes confirmation dialog.

The default is "Cancel".


DBKit.Container.ConfirmContinueButtonCaption

ConfirmContinueButtonCaption As String

The caption of the Continue button in the unsaved-changes confirmation dialog.

The default is "Continue".


DBKit.Container.CurrentRow

CurrentRow As DBKit.Row

The current row of the database table this container operates on.


DBKit.Container.Database

Database As Database

The database this container operates on.


DBKit.Container.DeleteConfirmExplanation

DeleteConfirmExplanation As String

The explanation text of the delete confirmation dialog.

The default is "This action cannot be undone."


DBKit.Container.DeleteConfirmMessage

DeleteConfirmMessage As String

The message text of the delete confirmation dialog.

The default is "Are you sure you want to delete this record?".


DBKit.Container.DeleteConfirmTitle

DeleteConfirmTitle As String

The title of the delete confirmation dialog.

The default is "Delete Record".


DBKit.Container.OrderBy

OrderBy As String

The sort order used when loading rows from the database table.


DBKit.Container.SelectedRowIndex

SelectedRowIndex As Integer

The index of the currently selected row in the list control.


DBKit.Container.TableName

TableName As String

The name of the database table this container operates on.


DBKit.Container.TableRelationships

TableRelationships As String

The relationships between this container's table and other tables, with one relationship per line in the format childTableName.childColumnName = parentTableName.parentColumnName. Appending = viaColumnName is optional and specifies the via column, which identifies which relationship to use when the child table has more than one foreign key to the same parent table.

The child column is the foreign key and the parent column is the primary key it refers to. The relationships are loaded when the container opens and are used to find related rows.


DBKit.Container.UnsavedChangesExplanation

UnsavedChangesExplanation As String

The explanation text of the unsaved-changes confirmation dialog.

The default is "If you continue, your changes will not be saved.".


DBKit.Container.UnsavedChangesMessage

UnsavedChangesMessage As String

The message text of the unsaved-changes confirmation dialog.

The default is "You have unsaved changes.".


DBKit.Container.UnsavedChangesTitle

UnsavedChangesTitle As String

The title of the unsaved-changes confirmation dialog.

The default is "Unsaved Changes".


DBKit.Container.Where

Where As String

The filter used when loading rows from the database table.

Method descriptions


DBKit.Container.Close

Close()

Closes the container.

Important

This method is only available in desktop projects.


DBKit.Container.Constructor

Constructor(theRowsSource As DBKit.SDK.RowsListControl, createNewRow As Boolean)

Called when the container is created. Sets up the container's layout and optionally creates a new row. theRowsSource is the rows list control the container is associated with; pass Nil for none. createNewRow is True to create a new row when the container opens.

Event descriptions


DBKit.Container.Error

Error(error As RuntimeException)

The error passed to this event has occurred.


DBKit.Container.RowChanged

RowChanged(row As DBKit.Row)

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


DBKit.Container.RowCreated

RowCreated(row As DBKit.Row)

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


DBKit.Container.RowDeleted

RowDeleted(row As DBKit.Row)

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


DBKit.Container.RowEditing

RowEditing(row As DBKit.Row)

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


DBKit.Container.RowLoaded

RowLoaded(row As DBKit.Row)

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


DBKit.Container.RowNotSelected

RowNotSelected

There is no row currently selected.


DBKit.Container.RowSaved

RowSaved(row As DBKit.Row)

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


DBKit.Container.RowSaving

RowSaving(row As DBKit.Row)

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


DBKit.Container.RowUndone

RowUndone(row As DBKit.Row)

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

Notes

Containers do not need a DBKit layout

A DBKit.Container does not have to be placed on a DBKit.Window. It is a layout in its own right: place it on any window, set its Database and TableName, and add DBKit controls to it.

Connecting the layout to a database

Add a DatabaseConnection object to your project and assign it to the Database property in the Layout Editor. That is how the layout knows which database connection to use.

How controls find their columns

If a control's ColumnName is blank, the control's own name is used as the column name. You only need to set ColumnName if you want a different column or cannot name the control the same as the column.

Filtering and sorting rows

Use Where to filter which rows are loaded and OrderBy to sort them. Provide just the expression in each case, not the SQL keywords: set Where to Country = 'USA' rather than WHERE Country = 'USA', and OrderBy to LastName rather than ORDER BY LastName.

Localization

Localize the layout's user-facing text (the delete-confirmation and unsaved-changes dialog text and the confirmation button captions) 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

DesktopContainer parent class; DBKit.Row class.