InputGroup
TsgcHTMLComponent_InputGroup — renderizza un input Bootstrap con testo addon anteposto e posposto (ad esempio $….00 o @username), in Delphi, C++ Builder e .NET.
TsgcHTMLComponent_InputGroup — renderizza un input Bootstrap con testo addon anteposto e posposto (ad esempio $….00 o @username), in Delphi, C++ Builder e .NET.
Un componente di input che emette un input-group Bootstrap con testo addon anteposto e posposto opzionale attorno a un form-control. Imposta i testi e l’input, quindi leggi la proprietà HTML.
TsgcHTMLComponent_InputGroup
Bootstrap 5 input-group markup
Delphi, C++ Builder, .NET
Imposta PrependText/AppendText e le proprietà dell’input, quindi leggi HTML — oppure chiama l’helper statico Build per una soluzione a riga singola.
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");
I membri che utilizzerai più spesso.
PrependText renderizza un addon input-group-text iniziale; AppendText ne renderizza uno finale. Lascia uno dei due vuoto per ometterlo.
InputName, InputValue e Placeholder popolano il form-control interno; InputType imposta la stringa grezza del tipo HTML.
InputTypeEnum (TsgcHTMLInputType) sceglie itText, itEmail, itNumber, itPassword, itTel e altri senza scrivere a mano la stringa del tipo.
Size (TsgcHTMLInputGroupSize) sceglie igsDefault, igsSmall o igsLarge per aggiungere il modificatore Bootstrap input-group-sm/-lg.
Build(prepend, inputName, placeholder, append) — e un overload che accetta un TsgcHTMLInputType — restituisce il markup in una riga senza gestire un’istanza.
HTML restituisce il <div> input-group completo; GroupID ne imposta l’attributo id per scripting o stile.