Tabs
TsgcHTMLComponent_Tabs — Delphi、C++ Builder、.NET で、切り替え可能なコンテンツペインを備えたタブ、ピル、またはアンダーラインのセットをレンダリングします。
TsgcHTMLComponent_Tabs — Delphi、C++ Builder、.NET で、切り替え可能なコンテンツペインを備えたタブ、ピル、またはアンダーラインのセットをレンダリングします。
Bootstrap のタブナビゲーションと、data-bs-toggle="tab" で配線されたペインの tab-content ブロックを出力するナビゲーションコンポーネントです。タイトルと内容を指定して項目を追加してから、HTML プロパティを読み取ります。
TsgcHTMLComponent_Tabs
Bootstrap のタブ + コンテンツペイン
Delphi, C++ Builder, .NET
Style を選択し、Title と Content を指定して項目をプッシュし(1 つを Active としてフラグ付け)、HTML を読み取ります。
uses
sgcHTML_Component_Tabs;
var
oTabs: TsgcHTMLComponent_Tabs;
begin
oTabs := TsgcHTMLComponent_Tabs.Create(nil);
try
oTabs.Style := tsTab;
oTabs.Fill := True;
with oTabs.Items.Add do begin Title := 'Overview'; Content := '<p>Welcome.</p>'; Active := True; end;
with oTabs.Items.Add do begin Title := 'Details'; Content := '<p>The details.</p>'; end;
with oTabs.Items.Add do begin Title := 'Settings'; Content := '<p>Settings.</p>'; end;
WebModule.Response := oTabs.HTML; // nav-tabs + tab-content
finally
oTabs.Free;
end;
end;
// includes: sgcHTML_Component_Tabs.hpp
TsgcHTMLComponent_Tabs *oTabs = new TsgcHTMLComponent_Tabs(NULL);
try
{
oTabs->Style = tsTab;
oTabs->Fill = true;
TsgcHTMLTabItem *oItem = oTabs->Items->Add();
oItem->Title = "Overview"; oItem->Content = "<p>Welcome.</p>"; oItem->Active = true;
oItem = oTabs->Items->Add(); oItem->Title = "Details"; oItem->Content = "<p>The details.</p>";
oItem = oTabs->Items->Add(); oItem->Title = "Settings"; oItem->Content = "<p>Settings.</p>";
String html = oTabs->HTML; // nav-tabs + tab-content
}
__finally
{
delete oTabs;
}
using esegece.sgcWebSockets;
var tabs = new TsgcHTMLComponent_Tabs();
tabs.Style = TsgcHTMLTabStyle.tsTab;
tabs.Fill = true;
var item = tabs.Items.Add();
item.Title = "Overview"; item.Content = "<p>Welcome.</p>"; item.Active = true;
item = tabs.Items.Add(); item.Title = "Details"; item.Content = "<p>The details.</p>";
item = tabs.Items.Add(); item.Title = "Settings"; item.Content = "<p>Settings.</p>";
string html = tabs.HTML; // nav-tabs + tab-content
最もよく使うメンバーです。
Items.Add は TsgcHTMLTabItem を返します。Title、Content(ペインのマークアップ)を設定し、読み込み時にペインが表示されるように 1 つを Active としてフラグ付けします。
Style は tsTab(既定)、tsPill、tsUnderline を選択し、nav-tabs、nav-pills、nav-underline にマッピングされます。
Vertical はナビゲーションを横方向に配置します。Fill と Justify は、利用可能な幅全体にタブボタンを広げます。
項目ごとに、Disabled はタブをグレーアウトし、TabID は生成されるペイン id を上書きします(そうでない場合は TabsID から導出されます)。
TabsID(既定値 sgcTabs)は、各ボタンをそのペインに配線する、生成されるタブとペインの id の接頭辞になります。
HTML は、ナビゲーションリストと tab-content ペインを返します — そのまま配信するか、ページテンプレートの BodyContent に割り当てます。