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

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.

Klasa komponentu

TsgcHTMLComponent_InputGroup

Renderuje

Znaczniki input-group Bootstrap 5

Języki

Delphi, C++ Builder, .NET

Utwórz go, dodaj dodatki, wyrenderuj

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

Kluczowe właściwości i metody

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

Dodatki

PrependText renderuje wiodący dodatek input-group-text; AppendText renderuje końcowy. Pozostaw którykolwiek pusty, aby go pominąć.

Pole

InputName, InputValue i Placeholder wypełniają wewnętrzny form-control; InputType ustawia surowy ciąg typu HTML.

Typ pola

InputTypeEnum (TsgcHTMLInputType) wybiera itText, itEmail, itNumber, itPassword, itTel i więcej bez ręcznego kodowania ciągu typu.

Rozmiar

Size (TsgcHTMLInputGroupSize) wybiera igsDefault, igsSmall lub igsLarge, aby dodać modyfikator input-group-sm/-lg Bootstrap.

Metoda pomocnicza

Build(prepend, inputName, placeholder, append) — oraz przeciążenie przyjmujące TsgcHTMLInputType — zwraca znaczniki w jednej linii bez zarządzania instancją.

Wynik

HTML zwraca kompletny <div> input-group; GroupID ustawia jego atrybut id do skryptowania lub stylowania.

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 dodaj grupy pól do swojej aplikacji webowej w Delphi, C++ Builder lub .NET.