The Dbedit component of Delphi is located on the data controls page of the palette, which is used to edit the value of a field currently recorded in the datasheet. The main properties and methods of the Dbedit component are as follows:
1. Main properties
(1) DataSource
Use to select a data source so that the Dbedit component connects to the datasheet through a data source. When Dbedit is connected to a data table through a data source, it is determined by the DataField field to display which field of the datasheet.
(2) DataField
Used to select a data field, and if DataField is set to TB0602, Dbedit is used to display values that are TB0602 with the edit field.
DataSource and DataField are the 2 most important properties that data interface components use to select data tables and fields.
(3) Enabled
When enabled is true, the data interface component is valid, and the component can be used for editing operations. When enabled to false, the data interface component is invalid, and the component is grayed out after it is run and cannot be manipulated with the mouse or keyboard.
(4) ReadOnly
When ReadOnly is true, the data can only be read and cannot be modified, or false, and the data can be read and writable. The default value is False.
These properties are also common to most data interface components, so in the following component descriptions, the above properties are not repeated.
2. Main methods
(1) OnChange
This event is triggered when the field contents are changed.
(2) OnClick
Click the component with the mouse to trigger the event.
(3) OnDblClick
The event is triggered by double-clicking the component with the mouse.
(4) OnKeyDown
This event is triggered when the key is pressed.
(5) OnKeyUp
This event is triggered when the key is released.
(6) OnMouseDown
This event is triggered when the mouse is pressed.
(7) OnMouseUp
This event is triggered when the mouse is released.
Readers should note that the above method is also the majority of data interface components common method, we can try to write a small program, so you can grasp.