Toolbar

TsgcHTMLComponent_Toolbar — render a button toolbar that groups buttons with separators, icons and tooltips, in Delphi, C++ Builder and .NET.

TsgcHTMLComponent_Toolbar

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.

Klasa komponentu

TsgcHTMLComponent_Toolbar

Renderuje

Bootstrap btn-toolbar markup

Języki

Delphi, C++ Builder, .NET

Create it, add buttons, render it

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">

Kluczowe właściwości i metody

Składniki, po które sięgasz najczęściej.

Buttons

AddButton(text, style, href) appends a button; with no href it renders a <button>, otherwise an anchor styled as a button.

Groups

AddSeparator closes the current btn-group and starts a new one with a small gap, so buttons cluster into logical groups.

Items

Items.Add returns a TsgcHTMLToolbarItem for finer control: set Text, Href, ButtonStyle, Icon, Disabled, Separator and Tooltip.

Style

Per item, ButtonStyle picks any TsgcHTMLButtonStyle (solid or outline variant, default bsOutlinePrimary); Tooltip wires a Bootstrap tooltip.

Size

Size selects tbsDefault, tbsSmall or tbsLarge, applied to each button group; ToolbarID sets the id.

Output

HTML returns the full <div class="btn-toolbar"> with its button groups — serve it, or assign it to a page template's BodyContent.

Poznawaj dalej

Wszystkie komponenty sgcHTMLPrzejrzyj pełną matrycę funkcji 60+ komponentów.
Pobierz bezpłatną wersję próbną30-dniowa wersja próbna zawiera projekty demonstracyjne 60.HTML.
CennikLicencje Single, Team i Site z pełnym kodem źródłowym.

Gotowy, aby zacząć?

Pobierz bezpłatną wersję próbną i zacznij budować interfejsy webowe w Delphi, C++ Builder i .NET.