Toolbar
TsgcHTMLComponent_Toolbar — render a button toolbar that groups buttons with separators, icons and tooltips, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_Toolbar — render a button toolbar that groups buttons with separators, icons and tooltips, in Delphi, C++ Builder and .NET.
A navigation component that emits a Bootstrap <div class="btn-toolbar"> of btn-groups split by separators. Add buttons (and separators), then read the HTML property.
TsgcHTMLComponent_Toolbar
Bootstrap btn-toolbar markup
Delphi, C++ Builder, .NET
Call AddButton for each button and AddSeparator to break the groups, then read HTML.
uses
sgcHTML_Enums, sgcHTML_Component_Toolbar;
var
oToolbar: TsgcHTMLComponent_Toolbar;
begin
oToolbar := TsgcHTMLComponent_Toolbar.Create(nil);
try
oToolbar.Size := tbsDefault;
oToolbar.AddButton('New', bsPrimary, '/new');
oToolbar.AddButton('Edit', bsOutlinePrimary, '/edit');
oToolbar.AddSeparator;
oToolbar.AddButton('Delete', bsOutlineDanger, '/delete');
WebModule.Response := oToolbar.HTML; // <div class="btn-toolbar">
finally
oToolbar.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Toolbar.hpp
TsgcHTMLComponent_Toolbar *oToolbar = new TsgcHTMLComponent_Toolbar(NULL);
try
{
oToolbar->Size = tbsDefault;
oToolbar->AddButton("New", bsPrimary, "/new");
oToolbar->AddButton("Edit", bsOutlinePrimary, "/edit");
oToolbar->AddSeparator();
oToolbar->AddButton("Delete", bsOutlineDanger, "/delete");
String html = oToolbar->HTML; // <div class="btn-toolbar">
}
__finally
{
delete oToolbar;
}
using esegece.sgcWebSockets;
var toolbar = new TsgcHTMLComponent_Toolbar();
toolbar.Size = TsgcHTMLToolbarSize.tbsDefault;
toolbar.AddButton("New", TsgcHTMLButtonStyle.bsPrimary, "/new");
toolbar.AddButton("Edit", TsgcHTMLButtonStyle.bsOutlinePrimary, "/edit");
toolbar.AddSeparator();
toolbar.AddButton("Delete", TsgcHTMLButtonStyle.bsOutlineDanger, "/delete");
string html = toolbar.HTML; // <div class="btn-toolbar">
The members you reach for most often.
AddButton(text, style, href) appends a button; with no href it renders a <button>, otherwise an anchor styled as a button.
AddSeparator closes the current btn-group and starts a new one with a small gap, so buttons cluster into logical groups.
Items.Add returns a TsgcHTMLToolbarItem for finer control: set Text, Href, ButtonStyle, Icon, Disabled, Separator and Tooltip.
Per item, ButtonStyle picks any TsgcHTMLButtonStyle (solid or outline variant, default bsOutlinePrimary); Tooltip wires a Bootstrap tooltip.
Size selects tbsDefault, tbsSmall or tbsLarge, applied to each button group; ToolbarID sets the id.
HTML returns the full <div class="btn-toolbar"> with its button groups — serve it, or assign it to a page template's BodyContent.