InputGroup
TsgcHTMLComponent_InputGroup — renderuje pole Bootstrap z dodatkiem tekstowym z przodu i na końcu (na przykład $….00 lub @username), w Delphi, C++ Builder i .NET.
TsgcHTMLComponent_InputGroup — renderuje pole Bootstrap z dodatkiem tekstowym z przodu i na końcu (na przykład $….00 lub @username), w Delphi, C++ Builder i .NET.
Komponent pola, który generuje element input-group Bootstrap z opcjonalnym dodatkiem tekstowym z przodu i na końcu wokół form-control. Ustaw teksty i pole, a następnie odczytaj właściwość HTML.
TsgcHTMLComponent_InputGroup
Znaczniki input-group Bootstrap 5
Delphi, C++ Builder, .NET
Ustaw PrependText/AppendText i właściwości pola, a następnie odczytaj HTML — albo wywołaj statyczną metodę pomocniczą Build dla jednolinijkowca.
uses
sgcHTML_Enums, sgcHTML_Component_InputGroup;
var
oGroup: TsgcHTMLComponent_InputGroup;
begin
oGroup := TsgcHTMLComponent_InputGroup.Create(nil);
try
oGroup.PrependText := '$';
oGroup.AppendText := '.00';
oGroup.InputName := 'amount';
oGroup.InputTypeEnum := itNumber;
oGroup.Placeholder := '0';
oGroup.Size := igsLarge;
WebModule.Response := oGroup.HTML; // <div class="input-group">...
finally
oGroup.Free;
end;
end;
// Or the static one-liner (prepend, name, placeholder, append):
Result := TsgcHTMLComponent_InputGroup.Build('@', 'user', 'username');
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_InputGroup.hpp
TsgcHTMLComponent_InputGroup *oGroup = new TsgcHTMLComponent_InputGroup(NULL);
try
{
oGroup->PrependText = "$";
oGroup->AppendText = ".00";
oGroup->InputName = "amount";
oGroup->InputTypeEnum = itNumber;
oGroup->Placeholder = "0";
oGroup->Size = igsLarge;
String html = oGroup->HTML; // <div class="input-group">...
}
__finally
{
delete oGroup;
}
// Or the static one-liner:
String html = TsgcHTMLComponent_InputGroup::Build("@", "user", "username");
using esegece.sgcWebSockets;
var group = new TsgcHTMLComponent_InputGroup();
group.PrependText = "$";
group.AppendText = ".00";
group.InputName = "amount";
group.InputTypeEnum = TsgcHTMLInputType.itNumber;
group.Placeholder = "0";
group.Size = TsgcHTMLInputGroupSize.igsLarge;
string html = group.HTML; // <div class="input-group">...
// Or the static one-liner:
string html2 = TsgcHTMLComponent_InputGroup.Build("@", "user", "username");
Składniki, po które sięgasz najczęściej.
PrependText renderuje wiodący dodatek input-group-text; AppendText renderuje końcowy. Pozostaw którykolwiek pusty, aby go pominąć.
InputName, InputValue i Placeholder wypełniają wewnętrzny form-control; InputType ustawia surowy ciąg typu HTML.
InputTypeEnum (TsgcHTMLInputType) wybiera itText, itEmail, itNumber, itPassword, itTel i więcej bez ręcznego kodowania ciągu typu.
Size (TsgcHTMLInputGroupSize) wybiera igsDefault, igsSmall lub igsLarge, aby dodać modyfikator input-group-sm/-lg Bootstrap.
Build(prepend, inputName, placeholder, append) — oraz przeciążenie przyjmujące TsgcHTMLInputType — zwraca znaczniki w jednej linii bez zarządzania instancją.
HTML zwraca kompletny <div> input-group; GroupID ustawia jego atrybut id do skryptowania lub stylowania.