Navigating and Manipulating Records
Go Up to Using data controls Index
Vcl.DBCtrls.TDBNavigator provides users a simple control for navigating through records in a dataset, and for manipulating records. The navigator consists of a series of buttons that enable a user to scroll forward or backward through records one at a time, go to the first record, go to the last record, insert a new record, update an existing record, post data changes, cancel data changes, delete a record, and refresh record display.
The following figure shows the navigator that appears by default when you place it on a form at design time. The navigator consists of a series of buttons that let a user navigate from one record to another in a dataset, and edit, delete, insert, and post records. The VisibleButtons property of the navigator enables you to hide or show a subset of these buttons dynamically. See Choosing Navigator Buttons to Display for more information.
The following table describes the buttons on the navigator.
TDBNavigator buttons :
Button | Purpose |
---|---|
First |
Calls the First method of the dataset to set the current record to the first record. |
Prior |
Calls the Prior method of the dataset to set the current record to the previous record. |
Next |
Calls the Next method of the dataset to set the current record to the next record. |
Last |
Calls the Last method of the dataset to set the current record to the last record. |
Insert |
Calls the Insert method of the dataset to insert a new record before the current record, and set the dataset in Insert state. |
Delete |
Deletes the current record. If the ConfirmDelete property is True it prompts for confirmation before deleting. |
Edit |
Puts the dataset in Edit state so that the current record can be modified. |
Post |
Writes changes in the current record to the database. |
Cancel |
Cancels edits to the current record, and returns the dataset to Browse state. |
Refresh |
Clears data control display buffers, then refreshes its buffers from the physical table or query. Useful if the underlying data may have been changed by another application. |
See Displaying Fly-over Help for information on associating help hints with each button. See Using a Single Navigator for Multiple Datasets for information about associating a navigator with multiple datasets.