YOUSEFUL / DELPHI / COMPONENTS
TAtlasCommandBar
Tabbed command bar that groups action-bound buttons under tab and group captions.
Description
TAtlasCommandBar is a TPageControl, 150 pixels high by default. AddCommand finds or creates the tab with the given caption, finds or creates a captioned group on it, and adds a 100 x 34 button bound to a TCustomAction such as TAction. The button follows the action: caption, enabled and visible state, hint, and OnExecute when clicked. Groups are 220 pixels wide and laid out left to right in the order they were created; buttons flow two per row, and at the default height two rows (four buttons) are visible per group.
Use the same actions for TAtlasNavigation and TAtlasTileBoard. Not implemented: images, large and small button styles, drop-down buttons, collapsing, a quick access toolbar and key tips. Commands cannot be removed except by freeing the returned button.
Members
| Member | Kind | What it does |
|---|---|---|
Create | constructor | Creates an empty command bar, 150 pixels high. |
Destroy | destructor | Frees its internal group table; the tabs, groups and buttons are owned by the bar and freed with it. |
AddCommand | method | Adds a button for Action to group GroupCaption on tab TabCaption, creating either when needed (captions match exactly, case-sensitively). |
Constructors
Create constructor
constructor Create(AOwner: TComponent); override;Creates an empty command bar, 150 pixels high.
Destructors
Destroy destructor
destructor Destroy; override;Frees its internal group table; the tabs, groups and buttons are owned by the bar and freed with it.
Methods
AddCommand method
function AddCommand(const TabCaption, GroupCaption: string; Action: TCustomAction): TButton;Adds a button for Action to group GroupCaption on tab TabCaption, creating either when needed (captions match exactly, case-sensitively). Returns the button, owned by the bar. Raises EAtlasLayoutError when Action is nil.
Button := Commands.AddCommand('Home', 'File', SaveAction);
Button.Hint := 'Save the document';Examples
Command bar with two tabs
Three actions on two tabs. Enabling or disabling an action updates its button at once.
uses System.Classes, Vcl.Controls, Vcl.ActnList, Atlas.Layout;
function AddCommands(Owner: TComponent; Parent: TWinControl; Save, Print, Refresh: TAction): TAtlasCommandBar;
begin
Result := TAtlasCommandBar.Create(Owner);
Result.Parent := Parent;
Result.Align := alTop;
Result.AddCommand('Home', 'File', Save);
Result.AddCommand('Home', 'File', Print);
Result.AddCommand('View', 'Data', Refresh);
end;
Related
TAtlasWorkspace · TAtlasNavigation · TAtlasTileBoard · TAtlasActionTile
Also in Atlas VCL
TAtlasTable · TAtlasGrid · TAtlasValueEdit · TAtlasTree · TAtlasWorkbook · TAtlasSheetGrid · TAtlasPivot · TAtlasInspector · TAtlasRichEdit · TAtlasSpellChecker · TAtlasChart · TAtlasGauge · TAtlasThemer · TAtlasWizard · TAtlasWorkspace · TAtlasActionTile · TAtlasTileBoard · TAtlasNavigation · TAtlasMap · TAtlasGraph · TAtlasDiagram · TAtlasPrintDocument · TAtlasSchedule · TAtlasScheduler · TAtlasTaskPlan · TAtlasGantt · TAtlasPdfDocument · TAtlasPdfViewer