CheckBox
TsgcHTMLComponent_CheckBox — un campo checkbox (o interruttore) con etichetta e binding ai dataset che renderizza markup form-check Bootstrap 5, in Delphi, C++ Builder e .NET.
TsgcHTMLComponent_CheckBox — un campo checkbox (o interruttore) con etichetta e binding ai dataset che renderizza markup form-check Bootstrap 5, in Delphi, C++ Builder e .NET.
Un campo booleano autonomo che emette un form-check Bootstrap — attiva Switch per renderizzarlo come interruttore. Imposta il nome, l’etichetta e lo stato selezionato, quindi leggi la proprietà HTML. È distribuito nella stessa unit dei campi affini Edit, Memo e RadioGroup.
TsgcHTMLComponent_CheckBox
Bootstrap 5 form-check input
Delphi, C++ Builder, .NET
Imposta Name, Label_ e Checked (e facoltativamente Switch), quindi leggi HTML (oppure inseriscilo in una pagina TsgcHTMLTemplate_Bootstrap).
uses
sgcHTML_Component_Edit;
var
oCheck: TsgcHTMLComponent_CheckBox;
begin
oCheck := TsgcHTMLComponent_CheckBox.Create(nil);
try
oCheck.Name := 'newsletter';
oCheck.Label_ := 'Subscribe to the newsletter';
oCheck.Checked := True;
oCheck.Switch := True; // render as a toggle switch
WebModule.Response := oCheck.HTML; // Bootstrap form-check
finally
oCheck.Free;
end;
end;
// Or bind it to a boolean dataset field:
oCheck.DataField := 'Active';
oCheck.DataSource := dsCustomer;
// includes: sgcHTML_Component_Edit.hpp
TsgcHTMLComponent_CheckBox *oCheck = new TsgcHTMLComponent_CheckBox(NULL);
try
{
oCheck->Name = "newsletter";
oCheck->Label_ = "Subscribe to the newsletter";
oCheck->Checked = true;
oCheck->Switch = true; // render as a toggle switch
String html = oCheck->HTML; // Bootstrap form-check
}
__finally
{
delete oCheck;
}
using esegece.sgcWebSockets;
var check = new TsgcHTMLComponent_CheckBox();
check.Name = "newsletter";
check.Label_ = "Subscribe to the newsletter";
check.Checked = true;
check.Switch = true; // render as a toggle switch
string html = check.HTML; // Bootstrap form-check
I membri che utilizzerai più spesso.
Name imposta il nome del campo, Label_ la didascalia visibile e CheckBoxID l’id dell’elemento (il valore predefinito è chk_<Name>).
Checked imposta il valore iniziale e Disabled disattiva il controllo.
Switch sostituisce la casella con un interruttore Bootstrap form-switch mantenendo la stessa semantica della checkbox.
DataField insieme a un DataSource assegnato imposta Checked dal campo booleano del record corrente.
HTML restituisce il wrapper form-check con il suo input e l’etichetta. La stessa unit dichiara i campi affini TsgcHTMLComponent_Edit, TsgcHTMLComponent_Memo e TsgcHTMLComponent_RadioGroup.