Class
DBKit.Window
DBKit.Window
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.Window itself are described here; for the inherited members, see the parent class.
Properties
Name |
Type |
Read-Only |
|---|---|---|
Methods
Name |
Parameters |
Returns |
|---|---|---|
theRowsSource As |
||
|
||
parentTableName As String |
||
Events
Name |
Parameters |
Returns |
|---|---|---|
error As RuntimeException |
||
row As DBKit.Row |
||
row As DBKit.Row |
||
row As DBKit.Row |
||
row As DBKit.Row |
||
row As DBKit.Row |
||
row As DBKit.Row |
||
row As DBKit.Row |
||
row As DBKit.Row |
Property descriptions
DBKit.Window.AutomaticHints
AutomaticHints As Boolean
Whether the controls on this window automatically set their Hint from the database column's display name when no Hint is set.
The default is True.
DBKit.Window.ConfirmCancelButtonCaption
ConfirmCancelButtonCaption As String
The caption of the Cancel button in the unsaved-changes confirmation dialog.
The default is "Cancel".
DBKit.Window.ConfirmContinueButtonCaption
ConfirmContinueButtonCaption As String
The caption of the Continue button in the unsaved-changes confirmation dialog.
The default is "Continue".
DBKit.Window.CurrentRow
CurrentRow As DBKit.Row
The current row of the database table this window operates on.
DBKit.Window.Database
Database As Database
The database this window operates on.
DBKit.Window.DeleteConfirmExplanation
DeleteConfirmExplanation As String
The explanation text of the delete confirmation dialog.
The default is "This action cannot be undone."
DBKit.Window.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.Window.DeleteConfirmTitle
DeleteConfirmTitle As String
The title of the delete confirmation dialog.
The default is "Delete Record".
DBKit.Window.OrderBy
OrderBy As String
The sort order used when loading rows from the database table.
DBKit.Window.SelectedRowIndex
SelectedRowIndex As Integer
The index of the currently selected row in the list control.
DBKit.Window.TableName
TableName As String
The name of the database table this window operates on.
DBKit.Window.TableRelationships
TableRelationships As String
The relationships between this window'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 window opens and are used to find related rows.
DBKit.Window.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.Window.UnsavedChangesMessage
UnsavedChangesMessage As String
The message text of the unsaved-changes confirmation dialog.
The default is "You have unsaved changes.".
DBKit.Window.UnsavedChangesTitle
UnsavedChangesTitle As String
The title of the unsaved-changes confirmation dialog.
The default is "Unsaved Changes".
DBKit.Window.Where
Where As String
The filter used when loading rows from the database table.
Method descriptions
DBKit.Window.Close
Close()
Closes the window.
Important
This method is only available in desktop projects.
DBKit.Window.Constructor
Constructor(theRowsSource As DBKit.SDK.RowsListControl, createNewRow As Boolean)
Called when the window is created. Sets up the window's layout and optionally creates a new row. theRowsSource is the rows list control the window is associated with; pass Nil for none. createNewRow is True to create a new row when the window opens.
DBKit.Window.DBKitControls
DBKitControls() As DBKit.SDK.RowBase()
Returns the DBKit controls on this window.
DBKit.Window.ForeignKeyColumnName
ForeignKeyColumnName(parentTableName As String) As String
Returns the name of the foreign key column in this window's table that relates to the table parentTableName.
DBKit.Window.TableName
TableName() As String
Returns the name of the database table for this window: the TableName property if set, otherwise the window's name.
Event descriptions
DBKit.Window.Error
Error(error As RuntimeException)
The error passed to this event has occurred.
DBKit.Window.RowChanged
RowChanged(row As DBKit.Row)
The current row (passed to the event) has been changed.
DBKit.Window.RowCreated
RowCreated(row As DBKit.Row)
A new row (passed to the event) was just created and is now the current row.
DBKit.Window.RowDeleted
RowDeleted(row As DBKit.Row)
The current row (passed to the event) has been deleted.
DBKit.Window.RowEditing
RowEditing(row As DBKit.Row)
The current row (passed to the event) is being edited by the user.
DBKit.Window.RowLoaded
RowLoaded(row As DBKit.Row)
The current row (passed to the event) has been loaded.
DBKit.Window.RowNotSelected
RowNotSelected
There is no row currently selected.
DBKit.Window.RowSaved
RowSaved(row As DBKit.Row)
The current row (passed to the event) has been saved.
DBKit.Window.RowSaving
RowSaving(row As DBKit.Row)
The current row (passed to this event) is about to be saved.
DBKit.Window.RowUndone
RowUndone(row As DBKit.Row)
The changes made to the current row (passed to this event) have been undone.
Notes
Unsaved changes when closing
If the window is closed while the current row is being edited and has unsaved changes, a dialog asks whether to continue closing (discarding the changes) or cancel the close.
Invalid column assignments
If a control on the layout is assigned a column name that does not exist in the layout's table, an exception is raised when the layout is displayed.
Assigning CurrentRow
CurrentRow can be assigned a DBKit.Row to make that row the window's current row.
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
DesktopWindow parent class; DBKit.Row class.