Skip to content

TStyledBindNavigator - Technical Reference

Overview

TStyledBindNavigator is a styled LiveBindings navigator component that replaces the standard TBindNavigator with modern styled buttons and enhanced visual features.

Class Hierarchy

TWinControl
  └─ TCustomPanel
      └─ TStyledBindNavigator

Unit

pascal
Vcl.StyledDbNavigator

Description

TStyledBindNavigator provides all functionality of TBindNavigator for LiveBindings while offering modern styling, better icons (especially for vertical orientation), optional button captions, and full customization of button appearance.

This component works with LiveBindings datasets instead of traditional database components.

Key Features

  • All TBindNavigator functionality: First, Prior, Next, Last, Insert, Delete, Edit, Post, Cancel, Refresh, ApplyUpdates, CancelUpdates
  • Styled buttons: Full StyleFamily/Class/Appearance support
  • Optional captions: Show/hide button captions
  • Better vertical icons: Improved up/down arrow icons for vertical layout
  • Custom ImageList support: Use your own icons
  • Per-button styling: Each button can have its own style
  • Orientation: Horizontal or vertical layout
  • LiveBindings integration: Works with TBindSourceDB and other binding sources

Main Properties

LiveBindings Properties

PropertyTypeDescription
DataSourceTBindSourceDBLiveBindings data source to navigate
VisibleButtonsTBindNavButtonSetWhich buttons to show ([nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh, nbApplyUpdates, nbCancelUpdates])
ConfirmDeleteBooleanShow confirmation before deleting (default: True)

Layout Properties

PropertyTypeDescription
OrientationTNavigatorOrientationHorizontal or vertical button layout (nboHorizontal, nboVertical)
ShowCaptionsBooleanShow button captions (default: False)
ShowHintsBooleanShow button hints

Styling Properties

PropertyTypeDescription
StyleFamilyTStyledButtonFamilyStyle family for all buttons
StyleClassTStyledButtonClassStyle class for all buttons
StyleAppearanceTStyledButtonAppearanceAppearance for all buttons
StyleDrawTypeTStyledButtonDrawTypeButton shape
StyleRadiusIntegerCorner radius
FlatBooleanFlat button appearance

Images

PropertyTypeDescription
ImagesTCustomImageListCustom ImageList for button icons
ImageWidthIntegerWidth of images
ImageHeightIntegerHeight of images

Button Properties

PropertyTypeDescription
Buttons[Index]TStyledNavButtonAccess to individual navigation buttons (read-only)
ButtonWidthIntegerWidth of buttons (0 = auto)
ButtonHeightIntegerHeight of buttons (0 = auto)

The navigator contains these buttons:

ButtonPurposeDefault Caption
nbFirstGo to first recordFirst
nbPriorGo to previous recordPrior
nbNextGo to next recordNext
nbLastGo to last recordLast
nbInsertInsert new recordInsert
nbDeleteDelete current recordDelete
nbEditEdit current recordEdit
nbPostPost changesPost
nbCancelCancel changesCancel
nbRefreshRefresh datasetRefresh
nbApplyUpdatesApply pending updatesApply
nbCancelUpdatesCancel pending updatesCancel Updates

Events

EventDescription
OnClickButton clicked - parameter indicates which button
BeforeActionBefore navigation action - can be canceled

Usage Examples

Basic BindNavigator

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

BindNavigator with Captions

pascal
Nav := TStyledBindNavigator.CreateStyled(Self,
  ANGULAR_LIGHT_FAMILY,
  acl_primary,
  ANGULAR_RAISED);
Nav.Parent := Self;
Nav.DataSource := BindSourceDB1;
Nav.ShowCaptions := True;
Nav.ButtonWidth := 80;
Nav.StyleDrawType := btRounded;

Vertical BindNavigator

pascal
Nav := TStyledBindNavigator.CreateStyled(Self,
  BOOTSTRAP_FAMILY,
  btn_secondary,
  BOOTSTRAP_NORMAL);
Nav.Parent := Self;
Nav.DataSource := BindSourceDB1;
Nav.Align := alLeft;
Nav.Orientation := nboVertical;
Nav.Width := 40;
pascal
Nav := TStyledBindNavigator.CreateStyled(Self,
  BOOTSTRAP_FAMILY,
  btn_secondary,
  BOOTSTRAP_NORMAL);
Nav.DataSource := BindSourceDB1;
// Include update buttons for LiveBindings
Nav.VisibleButtons := [nbFirst, nbPrior, nbNext, nbLast, nbRefresh, nbApplyUpdates, nbCancelUpdates];
Nav.ShowCaptions := True;

Customizing Individual Buttons

pascal
Nav := TStyledBindNavigator.CreateStyled(Self,
  BOOTSTRAP_FAMILY,
  btn_secondary,
  BOOTSTRAP_NORMAL);
Nav.DataSource := BindSourceDB1;

// Customize Delete button to be red
Nav.Buttons[nbDelete].StyleClass := btn_danger;

// Customize Apply Updates button to be green
Nav.Buttons[nbApplyUpdates].StyleClass := btn_success;
Nav.Buttons[nbApplyUpdates].Caption := 'Save All';

// Customize Cancel Updates button to be warning
Nav.Buttons[nbCancelUpdates].StyleClass := btn_warning;

Handling OnClick Event

pascal
procedure TForm1.BindNavigator1Click(Sender: TObject; Button: TNavigateBtn);
begin
  case Button of
    nbApplyUpdates:
      if MessageDlg('Apply all pending updates?', mtConfirmation, [mbYes, mbNo], 0) = mrNo then
        Exit;
    nbCancelUpdates:
      if MessageDlg('Discard all changes?', mtWarning, [mbYes, mbNo], 0) = mrNo then
        Exit;
  end;
end;

Main Methods

RegisterDefaultRenderingStyle (Class Method)

Sets the default rendering style for all TStyledBindNavigator instances.

pascal
class procedure RegisterDefaultRenderingStyle(
  const ADrawType: TStyledButtonDrawType;
  const AFamily: TStyledButtonFamily = DEFAULT_CLASSIC_FAMILY;
  const AClass: TStyledButtonClass = DEFAULT_WINDOWS_CLASS;
  const AAppearance: TStyledButtonAppearance = DEFAULT_APPEARANCE;
  const AStyleRadius: Integer = DEFAULT_RADIUS); virtual;

Differences from TStyledDbNavigator

AspectTStyledBindNavigatorTStyledDbNavigator
Data SourceTBindSourceDB (LiveBindings)TDataSource (Classic DB)
Extra ButtonsnbApplyUpdates, nbCancelUpdatesNone
Use CaseLiveBindings applicationsTraditional database applications

Important Notes

  • LiveBindings Required: Works with TBindSourceDB and LiveBindings framework
  • Update Buttons: Includes ApplyUpdates and CancelUpdates for batch operations
  • Auto-Enable: Buttons automatically enable/disable based on dataset state
  • Vertical Icons: Improved icons for vertical orientation
  • DPI Aware: Automatically scales with DPI changes

See Also

Released under Apache License, Version 2.0.