Skip to content

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 ​

pascal
Vcl.StyledDbNavigator

Description ​

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 ​

PropertyTypeDefaultDescription
DataSourceTBaseLinkingBindSourcenilLiveBindings source to navigate (for example a TBindSourceDB)
VisibleButtonsTNavigateButtonsNavigatorDefaultButtonsButtons shown (enumeration TNavigateButton of Data.Bind.Controls)
ConfirmDeleteBooleanTrueAsks for confirmation (MessageDlg) before deleting the record
MaxErrorsInteger-1Maximum number of errors for ApplyUpdates / CancelUpdates
EnabledBooleanTrueWhen False all the buttons are disabled

Layout, captions and hints ​

PropertyTypeDefaultDescription
OrientationTNavigatorOrientationorHorizontalorHorizontal or orVertical
KindTDBNavigatorKinddbnHorizontalSame setting of Orientation expressed as dbnHorizontal / dbnVertical
ShowCaptionsBooleanFalseShows the caption of each button
CaptionsTStringsbuilt-in textsOne line for each button; an empty line keeps the default
HintsTStringsbuilt-in textsOne line for each button; an empty line keeps the default
FlatBooleanFalseFlat buttons
CursorTCursorcrHandPointCursor of the navigator and of its buttons

Images ​

PropertyTypeDefaultDescription
ImagesTCustomImageListnilImages 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+)
DisabledImagesTCustomImageListnilImages of the disabled buttons

Style ​

PropertyTypeDefaultDescription
StyleFamilyTStyledButtonFamilyClassicStyle family of all the buttons
StyleClassTStyledButtonClassWindowsStyle class of all the buttons
StyleAppearanceTStyledButtonAppearanceNormalAppearance of all the buttons
StyleDrawTypeTStyledButtonDrawTypebtRoundRectShape of the buttons
StyleRadiusInteger6Corner radius
StyleShadowSizeInteger-1Shadow 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
StyleElementsTStyleElementsallVCL Style elements used with the Classic family
AsVCLComponentBooleannot storedFollows the VCL Style (Classic family)

Standard control properties ​

Align, Anchors, Constraints, Ctl3D, ParentCtl3D, DragCursor, DragKind, DragMode, ParentShowHint, ShowHint, PopupMenu, TabOrder, TabStop, Visible.

Events ​

EventTypeDescription
BeforeActionTNavigateButtonEvent (Sender: TObject; Button: TNavigateButton)Before the action of a button (not at design time). Raise Abort to skip the action
OnClickTNavigateButtonEventAfter the action of a button
OnEnableNavBtnTEnableNavBtnProcEnable/disable each button with your own rule (var AEnabled: Boolean)
OnContextPopup, OnDblClick, OnDragDrop, OnDragOver, OnEndDock, OnEndDrag, OnEnter, OnExit, OnResize, OnStartDock, OnStartDragStandard control events

Public members ​

MemberTypeDescription
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]TStyledNavButtonAccess to a single button (read-only); indexed by TNavigateBtn of Vcl.DBCtrls
ButtonsTNavButtonsArray of the buttons indexed by TNavigateBtn. In this class a protected property Buttons[Index: TNavigateButton] is declared: outside the unit use ButtonItems
ButtonWidth, ButtonHeightIntegerSize of a button (read-only)
StyleAppliedBooleanTrue when the style has been resolved
Assign(Source)Copies the settings of another navigator

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 ​

pascal
// 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 ​

Released under Apache License, Version 2.0.