[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'DbCtrls' (#lcl)

TDBCustomNavigator

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

TDBCustomNavigator - the base class for TDBNavigator, a tool for navigating through the records of a dataset

Declaration

Source position: dbctrls.pp line 1136

type TDBCustomNavigator = class(TCustomPanel)

protected

  Buttons: ;

  

The list of Buttons included in the navigator tool

  procedure DataChanged; virtual;

  

DataChanged - update status of all the buttons to reflect new data

  procedure EditingChanged; virtual;

  

EditingChanged - the status of the buttons is set to CanModify

  procedure ActiveChanged; virtual;

  

ActiveChanged - if datalink is active, calls DataChanged and EditingChanged

  procedure Loaded; override;

  

  procedure Notification(); override;

  

  procedure UpdateButtons; virtual;

  

UpdateButtons - if the position of the buttons need to be changed, does this, then updates the status of the buttons (see ActiveChanged)

  procedure UpdateHints; virtual;

  

UpdateHints - reloads the default hints and modifies any that have been changed

  procedure HintsChanged(); virtual;

  

HintsChanged - calls UpdateHints

  procedure ButtonClickHandler(); virtual;

  

ButtonClickHandler - performs BtnClick for the appropriate button

protected

  class function GetControlClassDefaultSize; override;

  

Find the default size for this class of controls (by reference to parents)

protected

  procedure BeginUpdateButtons; virtual;

  

BeginUpdateButtons - locks the buttons before updating them

  procedure EndUpdateButtons; virtual;

  

EndUpdateButtons - unlocks each button in turn and updates it if needed

  procedure SetEnabled(); override;

  

Set up the flag to determine whether the control is to be enabled

public

  constructor Create(); override;

  

Create - constructor for TDBCustomNavigator: locks the buttons, calls inherited Create, sets default size, style, forms datalinks, initialises hints, updates the buttons

  destructor Destroy; override;

  

Destroy - destructor for TDBCustomNavigator: frees datalinks and hints, then calls inherited Destroy

  procedure BtnClick(); virtual;

  

BtnClick - procedure to respond to button clicks, and select an action from a list according to the value of the Index of the clicked button

  function VisibleButtonCount; virtual;

  

Finds the number of visible buttons

  property BeforeAction: TDBNavClickEvent; [rw]

  

BeforeAction - code to be executed before an action is performed

  property ConfirmDelete: Boolean; [rw]

  

Should the user be asked for confirmation before a record is deleted? If True, a dialog appears asking for confirmation

  property DataSource: TDataSource; [rw]

  

The Data Source to which the control must be linked in order to function

  property Direction: TDBNavButtonDirection; [rw]

  

The direction in which the buttons appear: horizontal or vertical

  property Flat: Boolean; [rw]

  

Flat - if True, buttons have no 3-D effect

  property Hints: TStrings; [rw]

  

A list of hints to be shown if the mouse hovers over a button

  property OnClick: TDBNavClickEvent; [rw]

  

The action to be taken when a navigator button is clicked

  property VisibleButtons: TDBNavButtonSet; [rw]

  

The set of visible buttons (some of them can be suppressed if their function appears redundant)

  property ShowButtonHints: Boolean; [rw]

  

Determines whether button hints are to be shown

end;

Inheritance

TDBCustomNavigator

  

TDBCustomNavigator - the base class for TDBNavigator, a tool for navigating through the records of a dataset

|

TCustomPanel

  

TCustomPanel: The base type for TPanel

|

TCustomControl

  

TCustomControl - a base class for many window controls

|

TWinControl

|

TControl

|

TLCLComponent

  

TLCLComponent - base class for LCL components

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent

|

TObject

Description

TDBCustomNavigator is the parent class for TDBNavigator, an advanced tool for navigating through datasets held locally in response to a query sent to the database. Most of the important properties are defined here.

It consists of a series of toolbuttons to move to the First, Prior, Next or Last record; to Insert or Delete a record; to Edit a record (enter Edit mode), to Post the changes. to Cancel the changes, and to Refresh the display from the database. The set of buttons for display can be customised in VisibleButtons, which allows display of individual buttons to be suppressed

If used in conjunction with a DataAware control such as TDBGrid or TDBMemo it controls which records are displayed , the position of the record selection cursor, and the initiation of changes to the dataset and ultimately the database.

Most of the functionality of the toolbar is already built-in to the control, but if the programmer needs to specify actions to be associated with individual buttons, there is a procedure BtnClick to which an argument can be sent with the index value of the button clicked, and the procedure chooses which action to call dependent on the button index.

The DataSource property must be set to link to the appropriate set of data.

See also

HowToUseDataAwareControls

  

HowToUseDataAwareControls - Hints for accessing databases

The latest version of this document can be found at lazarus-ccr.sourceforge.net.