TStyledBindNavigator - Technical Reference
Overview
TStyledBindNavigator is a styled LiveBindings navigator that replaces the standard TBindNavigator. It shares the code of TStyledDbNavigator (same base class and same buttons) and differs for the binding source it works with. For the usage see TStyledBindNavigator.
Class Hierarchy
TCustomPanel
└─ TCustomStyledDBNavigator
└─ TStyledBindNavigator (implements IBindNavigator)Unit
Vcl.StyledDbNavigatorDescription
TStyledBindNavigator uses a TBindNavigatorController to follow the state of a TBaseLinkingBindSource (TBindSourceDB, TPrototypeBindSource...) and enables/disables the buttons accordingly. The buttons are TStyledNavButton objects (see the end of TStyledDbNavigator-Reference). The component is registered for Win32 and Win64 and has the Component Editor Styled DbNavigator Editor....
The members of the base class TCustomStyledDBNavigator are documented in TStyledDbNavigator-Reference; here they are listed in short.
Key Features
- All TBindNavigator functionality: First, Prior, Next, Last, Insert, Delete, Edit, Post, Cancel, Refresh, ApplyUpdates, CancelUpdates
- Styled buttons: StyleFamily / StyleClass / StyleAppearance / StyleDrawType / StyleRadius
- Captions, custom ImageList, built-in icons for light and dark styles, vertical icons
- LiveBindings integration through
IBindNavigator
Published properties (Object Inspector)
LiveBindings and behavior
| Property | Type | Default | Description |
|---|---|---|---|
DataSource | TBaseLinkingBindSource | nil | LiveBindings source to navigate (for example a TBindSourceDB) |
VisibleButtons | TNavigateButtons | NavigatorDefaultButtons | Buttons shown (enumeration TNavigateButton of Data.Bind.Controls) |
ConfirmDelete | Boolean | True | Asks for confirmation (MessageDlg) before deleting the record |
MaxErrors | Integer | -1 | Maximum number of errors for ApplyUpdates / CancelUpdates |
Enabled | Boolean | True | When False all the buttons are disabled |
Layout, captions and hints
| Property | Type | Default | Description |
|---|---|---|---|
Orientation | TNavigatorOrientation | orHorizontal | orHorizontal or orVertical |
Kind | TDBNavigatorKind | dbnHorizontal | Same setting of Orientation expressed as dbnHorizontal / dbnVertical |
ShowCaptions | Boolean | False | Shows the caption of each button |
Captions | TStrings | built-in texts | One line for each button; an empty line keeps the default |
Hints | TStrings | built-in texts | One line for each button; an empty line keeps the default |
Flat | Boolean | False | Flat buttons |
Cursor | TCursor | crHandPoint | Cursor of the navigator and of its buttons |
Images
| Property | Type | Default | Description |
|---|---|---|---|
Images | TCustomImageList | nil | Images of the buttons (index = Ord of the button; from index 12 on the vertical images). When nil the built-in icons are used (Delphi 10.4+) |
DisabledImages | TCustomImageList | nil | Images of the disabled buttons |
Style
| Property | Type | Default | Description |
|---|---|---|---|
StyleFamily | TStyledButtonFamily | Classic | Style family of all the buttons |
StyleClass | TStyledButtonClass | Windows | Style class of all the buttons |
StyleAppearance | TStyledButtonAppearance | Normal | Appearance of all the buttons |
StyleDrawType | TStyledButtonDrawType | btRoundRect | Shape of the buttons |
StyleRadius | Integer | 6 | Corner radius |
StyleShadowSize | Integer | -1 | Shadow of the buttons in pixels, the same in every state (-1 = the one of the style family, 0 = none); values below -1 raise an exception |
StyleElements | TStyleElements | all | VCL Style elements used with the Classic family |
AsVCLComponent | Boolean | not stored | Follows the VCL Style (Classic family) |
Standard control properties
Align, Anchors, Constraints, Ctl3D, ParentCtl3D, DragCursor, DragKind, DragMode, ParentShowHint, ShowHint, PopupMenu, TabOrder, TabStop, Visible.
Events
| Event | Type | Description |
|---|---|---|
BeforeAction | TNavigateButtonEvent (Sender: TObject; Button: TNavigateButton) | Before the action of a button (not at design time). Raise Abort to skip the action |
OnClick | TNavigateButtonEvent | After the action of a button |
OnEnableNavBtn | TEnableNavBtnProc | Enable/disable each button with your own rule (var AEnabled: Boolean) |
OnContextPopup, OnDblClick, OnDragDrop, OnDragOver, OnEndDock, OnEndDrag, OnEnter, OnExit, OnResize, OnStartDock, OnStartDrag | Standard control events |
Public members
| Member | Type | Description |
|---|---|---|
procedure BtnClick(Index: TNavigateButton) | Executes the action of a button through the controller (BeforeAction, action, OnClick) | |
constructor CreateStyled(AOwner; const AFamily; const AClass; const AAppearance) | Creates the navigator with a given style | |
class procedure RegisterDefaultRenderingStyle(...) | Default style of the navigators (inherited, see TStyledDbNavigator-Reference) | |
procedure SetDbNavigatorStyle(const AStyleFamily; const AStyleClass; const AStyleAppearance) | Sets family, class and appearance together; raises EStyledButtonError if not available | |
ButtonItems[Index: TNavigateBtn] | TStyledNavButton | Access to a single button (read-only); indexed by TNavigateBtn of Vcl.DBCtrls |
Buttons | TNavButtons | Array of the buttons indexed by TNavigateBtn. In this class a protected property Buttons[Index: TNavigateButton] is declared: outside the unit use ButtonItems |
ButtonWidth, ButtonHeight | Integer | Size of a button (read-only) |
StyleApplied | Boolean | True when the style has been resolved |
Assign(Source) | Copies the settings of another navigator |
Navigation buttons
The enumeration TNavigateButton has the same twelve values of TNavigateBtn: nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh, nbApplyUpdates, nbCancelUpdates. See the table in TStyledDbNavigator-Reference.
Examples
// Bootstrap navigator for a TBindSourceDB
Nav := TStyledBindNavigator.CreateStyled(Self,
BOOTSTRAP_FAMILY, btn_secondary, BOOTSTRAP_NORMAL);
Nav.Parent := Self;
Nav.DataSource := BindSourceDB1;
Nav.VisibleButtons := [TNavigateButton.nbFirst, TNavigateButton.nbPrior,
TNavigateButton.nbNext, TNavigateButton.nbLast, TNavigateButton.nbRefresh];
// Red Delete button
Nav.ButtonItems[TNavigateBtn.nbDelete].StyleClass := btn_danger;Replacing TBindNavigator with the Interposer unit
Vcl.StyledComponentsHooks declares TBindNavigator = class(TStyledBindNavigator). See Interposer Unit.
See Also
- TStyledBindNavigator - Usage and examples
- TStyledDbNavigator Reference - DataSource navigator and the TStyledNavButton class
- TStyledDbNavigator Demo
- TStyledToolbar Reference - Styled toolbar
