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
└─ TStyledBindNavigatorUnit
pascal
Vcl.StyledDbNavigatorDescription
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
| Property | Type | Description |
|---|---|---|
DataSource | TBindSourceDB | LiveBindings data source to navigate |
VisibleButtons | TBindNavButtonSet | Which buttons to show ([nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh, nbApplyUpdates, nbCancelUpdates]) |
ConfirmDelete | Boolean | Show confirmation before deleting (default: True) |
Layout Properties
| Property | Type | Description |
|---|---|---|
Orientation | TNavigatorOrientation | Horizontal or vertical button layout (nboHorizontal, nboVertical) |
ShowCaptions | Boolean | Show button captions (default: False) |
ShowHints | Boolean | Show button hints |
Styling Properties
| Property | Type | Description |
|---|---|---|
StyleFamily | TStyledButtonFamily | Style family for all buttons |
StyleClass | TStyledButtonClass | Style class for all buttons |
StyleAppearance | TStyledButtonAppearance | Appearance for all buttons |
StyleDrawType | TStyledButtonDrawType | Button shape |
StyleRadius | Integer | Corner radius |
Flat | Boolean | Flat button appearance |
Images
| Property | Type | Description |
|---|---|---|
Images | TCustomImageList | Custom ImageList for button icons |
ImageWidth | Integer | Width of images |
ImageHeight | Integer | Height of images |
Button Properties
| Property | Type | Description |
|---|---|---|
Buttons[Index] | TStyledNavButton | Access to individual navigation buttons (read-only) |
ButtonWidth | Integer | Width of buttons (0 = auto) |
ButtonHeight | Integer | Height of buttons (0 = auto) |
Navigation Buttons
The navigator contains these buttons:
| Button | Purpose | Default Caption |
|---|---|---|
nbFirst | Go to first record | First |
nbPrior | Go to previous record | Prior |
nbNext | Go to next record | Next |
nbLast | Go to last record | Last |
nbInsert | Insert new record | Insert |
nbDelete | Delete current record | Delete |
nbEdit | Edit current record | Edit |
nbPost | Post changes | Post |
nbCancel | Cancel changes | Cancel |
nbRefresh | Refresh dataset | Refresh |
nbApplyUpdates | Apply pending updates | Apply |
nbCancelUpdates | Cancel pending updates | Cancel Updates |
Events
| Event | Description |
|---|---|
OnClick | Button clicked - parameter indicates which button |
BeforeAction | Before 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;Navigator with Custom Buttons
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
| Aspect | TStyledBindNavigator | TStyledDbNavigator |
|---|---|---|
| Data Source | TBindSourceDB (LiveBindings) | TDataSource (Classic DB) |
| Extra Buttons | nbApplyUpdates, nbCancelUpdates | None |
| Use Case | LiveBindings applications | Traditional 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
- TStyledDbNavigator - Traditional database navigator
- TStyledToolbar - Styled toolbar
