Interface
DBKit.SDK.RowDataControl
DBKit.SDK.RowDataControl
Description
Implemented by a control that displays and edits one column of a row, such as the built-in TextField, CheckBox and Slider, and the Rating control in the DBKit example project. It extends DBKit.SDK.RowBase, so a control implementing it also provides the RowBase methods and receives row events through DBKit.SDK.RowEventReceiver.
DBKit works with the control in both directions. When a row is loaded or its values change, DBKit calls UpdateControlFromRow so the control can display the row's value for its column. When the row is saved, DBKit calls UpdateRowFromControl so the control can write its value into the row. Before a save, DBKit also asks the control whether its column must have a value and whether its current value is valid.
Methods
Name |
Parameters |
Returns |
|---|---|---|
row As DBKit.Row = Nil |
||
row As DBKit.Row |
Method descriptions
DBKit.SDK.RowDataControl.GetColumnName
GetColumnName() As String
Returns the name of the database column the control displays and edits. DBKit uses it to read the control's value from a row and to write it back.
DBKit.SDK.RowDataControl.GetDisplayName
GetDisplayName() As String
Returns the name DBKit uses when it refers to the control's column to the user, for example in the message shown when a mandatory column has no value.
DBKit.SDK.RowDataControl.HasValidValue
HasValidValue() As Boolean
Returns True if the control's current value can be saved. DBKit checks this, together with IsMandatory, before a row is saved; a row whose controls do not all have valid values is not saved.
DBKit.SDK.RowDataControl.IsMandatory
IsMandatory() As Boolean
Returns True if the control's column must have a value before the row can be saved.
DBKit.SDK.RowDataControl.UpdateControlFromRow
UpdateControlFromRow(row As DBKit.Row = Nil)
Called by DBKit when the control should display the value of its column from row. When row is Nil, there is no current row and the control should clear itself.
DBKit.SDK.RowDataControl.UpdateRowFromControl
UpdateRowFromControl(row As DBKit.Row)
Called by DBKit when the row is being saved, so the control can write its current value into row, in the column named by GetColumnName.
Notes
A control whose value the user can change directly should not wait for UpdateRowFromControl to record the change. As soon as its value changes, it should pass itself to its layout's UpdateCurrentRow method, as the built-in controls do. DBKit broadcasts a row event when any control on the layout is edited, and the other controls respond by reloading their values from the row; a control that has not yet written its change into the row will be reloaded with the row's previous value and the user's change will appear to revert.
The methods an interface requires can be implemented as Private, as the Rating example control does. DBKit works with the control through the interface, so the methods do not need to be public on the control class itself.
Compatibility
Project Types |
Desktop, Web |
Operating Systems |
All |
See also
DBKit SDK overview, DBKit.SDK.RowDataImageControl, DBKit.SDK.Layout.