Skip to content

Description of TStyledBindNavigator ​

TStyledBindNavigator is the styled version of the VCL TBindNavigator: the record navigator for LiveBindings data sources (TBindSourceDB, TPrototypeBindSource and any other TBaseLinkingBindSource). Like TStyledDbNavigator, every button is a styled button with captions, custom images and the full Style attributes of the library.

StyledDbNavigatorDemo.jpg

  • Unit: Vcl.StyledDbNavigator (the same unit of TStyledDbNavigator)
  • Palette: Styled Components
  • Inheritance: TCustomPanel > TCustomStyledDBNavigator > TStyledBindNavigator (implements IBindNavigator)
  • All properties, methods and events: TStyledBindNavigator Reference
  • Live demo: TStyledDbNavigator Demo (shows the DB and the Bind navigator together)

When to use it ​

Use TStyledBindNavigator when the form works with LiveBindings (the data source is a TBindSourceDB, TPrototypeBindSource, ...) and you want to replace TBindNavigator. If the controls are linked to a plain TDataSource use TStyledDbNavigator.

All the styling features (StyleFamily, StyleClass, StyleAppearance, StyleDrawType, StyleRadius, StyleShadowSize, captions, images, Flat, OnEnableNavBtn, the Component Editor) are the ones of the base class and work exactly as described in TStyledDbNavigator.

Differences from TStyledDbNavigator ​

TStyledDbNavigatorTStyledBindNavigator
Data source propertyDataSource: TDataSourceDataSource: TBaseLinkingBindSource
Buttons enumerationTNavigateBtn (Vcl.DBCtrls)TNavigateButton (Data.Bind.Controls)
VisibleButtonsTNavButtonSetTNavigateButtons; default NavigatorDefaultButtons
BeforeAction, OnClickENavClick, parameter TNavigateBtnTNavigateButtonEvent, parameter TNavigateButton
OrientationKind: TDBNavigatorKindKind and also Orientation: TNavigatorOrientation (orHorizontal, orVertical): they are the same setting
BtnClickBtnClick(Index: TNavigateBtn)BtnClick(Index: TNavigateButton)
Enabling the buttonsfrom the dataset statefrom the state of the binding source (TBindNavigatorController)
ActiveStyleNamepublishednot published

The identifiers of the two enumerations are the same (nbFirst, nbPrior...). If a unit uses both Vcl.DBCtrls and Data.Bind.Controls, qualify them (TNavigateButton.nbFirst) to select the right one.

To reach a single button use ButtonItems[...], indexed by TNavigateBtn (the property Buttons indexed by TNavigateButton is protected).

Design-time ​

Drop a TStyledBindNavigator from the Styled Components palette and set DataSource to the binding source (for example a TBindSourceDB). The Component Editor (verb Styled DbNavigator Editor...) is the same of the DB navigator: see Component Editor.

Examples ​

Create a styled BindNavigator at runtime ​

pascal
uses
  Data.Bind.Controls, Vcl.StyledDbNavigator, Vcl.BootstrapButtonStyles;

var
  Nav: TStyledBindNavigator;
begin
  Nav := TStyledBindNavigator.CreateStyled(Self,
    BOOTSTRAP_FAMILY, btn_primary, BOOTSTRAP_NORMAL);
  Nav.Parent := Self;
  Nav.Align := alBottom;
  Nav.DataSource := BindSourceDB1;
end;

Visible buttons, captions and orientation ​

pascal
Nav.VisibleButtons := [TNavigateButton.nbFirst, TNavigateButton.nbPrior,
  TNavigateButton.nbNext, TNavigateButton.nbLast];
Nav.ShowCaptions := True;
Nav.Orientation := orVertical;   // same as Nav.Kind := dbnVertical
Nav.Align := alLeft;

Style the navigator and a single button ​

pascal
uses
  Vcl.AngularButtonStyles;

Nav.SetDbNavigatorStyle(ANGULAR_M3_LIGHT_FAMILY, btn_Basic, FilledAttr);
Nav.ButtonItems[TNavigateBtn.nbDelete].StyleAppearance := OutlinedAttr;

See Angular Material 3 families.

Events ​

pascal
procedure TForm1.BindNavBeforeAction(Sender: TObject; Button: TNavigateButton);
begin
  // Abort skips the action
  if (Button = TNavigateButton.nbDelete) and not UserCanDelete then
    Abort;
end;

procedure TForm1.BindNavClick(Sender: TObject; Button: TNavigateButton);
begin
  if Button = TNavigateButton.nbPost then
    StatusBar1.SimpleText := 'Record saved';
end;

Programmatic click ​

pascal
Nav.BtnClick(TNavigateButton.nbNext);

Replacing TBindNavigator globally ​

The unit Vcl.StyledComponentsHooks declares TBindNavigator = class(TStyledBindNavigator): with it in the uses clause the TBindNavigator of the forms become styled ones, without changing the code. See Interposer Unit. The default style of all the navigators (DB and Bind) is set with TCustomStyledDBNavigator.RegisterDefaultRenderingStyle.

See also ​

Released under Apache License, Version 2.0.