Edit
TsgcHTMLComponent_Edit — Delphi、C++ Builder、.NET で、ラベル、ヘルプテキスト、入力タイプ、データセットバインディングを備え、Bootstrap 5 の form-control をレンダリングする 1 行テキスト入力欄です。
TsgcHTMLComponent_Edit — Delphi、C++ Builder、.NET で、ラベル、ヘルプテキスト、入力タイプ、データセットバインディングを備え、Bootstrap 5 の form-control をレンダリングする 1 行テキスト入力欄です。
ラベル付きの Bootstrap <input> を出力するスタンドアロンのテキスト入力欄です。名前、ラベル、入力タイプを設定してから、HTML プロパティを読み取ります。兄弟コンポーネントの Memo、CheckBox、RadioGroup の各入力と同じユニットに含まれています。
TsgcHTMLComponent_Edit
Bootstrap 5 の form-control 入力欄
Delphi, C++ Builder, .NET
Name、Label_、InputType、そして Placeholder を設定してから、HTML を読み取ります(または TsgcHTMLTemplate_Bootstrap ページに組み込みます)。
uses
sgcHTML_Enums, sgcHTML_Component_Edit;
var
oEdit: TsgcHTMLComponent_Edit;
begin
oEdit := TsgcHTMLComponent_Edit.Create(nil);
try
oEdit.Name := 'email';
oEdit.Label_ := 'Email address';
oEdit.InputType := itEmail;
oEdit.Placeholder := 'you@example.com';
oEdit.HelpText := 'We never share it.';
oEdit.Required := True;
WebModule.Response := oEdit.HTML; // Bootstrap form-control
finally
oEdit.Free;
end;
end;
// Or bind it to a dataset field:
oEdit.DataField := 'Email';
oEdit.DataSource := dsCustomer;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Edit.hpp
TsgcHTMLComponent_Edit *oEdit = new TsgcHTMLComponent_Edit(NULL);
try
{
oEdit->Name = "email";
oEdit->Label_ = "Email address";
oEdit->InputType = itEmail;
oEdit->Placeholder = "you@example.com";
oEdit->HelpText = "We never share it.";
oEdit->Required = true;
String html = oEdit->HTML; // Bootstrap form-control
}
__finally
{
delete oEdit;
}
using esegece.sgcWebSockets;
var edit = new TsgcHTMLComponent_Edit();
edit.Name = "email";
edit.Label_ = "Email address";
edit.InputType = TsgcHTMLInputType.itEmail;
edit.Placeholder = "you@example.com";
edit.HelpText = "We never share it.";
edit.Required = true;
string html = edit.HTML; // Bootstrap form-control
最もよく使うメンバーです。
Name はフィールド名を、Label_ は表示用のキャプションを、EditID は要素 id(既定値は edit_<Name>)を設定します。
Value は入力欄に初期値を設定し、Placeholder はゴーストテキストを表示し、HelpText はフィールドの下に Bootstrap の form-text ヒントを追加します。
InputType は TsgcHTMLInputType です — itText、itEmail、itPassword、itNumber、itTel、itURL、itDate、itColor、itRange、itFile など。
Required、Disabled、ReadOnly は、検証と編集のために入力欄にフラグを立てます。
DataField と割り当てた DataSource によって、現在のレコードから Value を埋めます。
HTML はラベル付きの form-control を返します。同じユニットには、兄弟コンポーネントの TsgcHTMLComponent_Memo、TsgcHTMLComponent_CheckBox、TsgcHTMLComponent_RadioGroup の各入力が宣言されています。