Select
TsgcHTMLComponent_Select — Delphi, C++ Builder 및 .NET에서 옵션 그룹, 다중 선택, 크기 조정 및 데이터셋 바인딩을 갖춘 Bootstrap 5 선택 드롭다운입니다.
TsgcHTMLComponent_Select — Delphi, C++ Builder 및 .NET에서 옵션 그룹, 다중 선택, 크기 조정 및 데이터셋 바인딩을 갖춘 Bootstrap 5 선택 드롭다운입니다.
레이블이 있는 Bootstrap form-select를 내보내는 드롭다운입니다. 옵션을 추가하고(또는 데이터셋을 바인딩하고), 선택적으로 그룹화하고 다중 선택을 허용한 다음, HTML 속성을 읽습니다.
TsgcHTMLComponent_Select
Bootstrap 5 form-select
Delphi, C++ Builder, .NET
Name, Label_ 및 Placeholder를 설정하고, AddOption(또는 AddOptionGroup)으로 옵션을 추가한 다음, HTML을 읽습니다(또는 TsgcHTMLTemplate_Bootstrap 페이지에 넣습니다).
uses
sgcHTML_Enums, sgcHTML_Component_Select;
var
oSelect: TsgcHTMLComponent_Select;
begin
oSelect := TsgcHTMLComponent_Select.Create(nil);
try
oSelect.Name := 'country';
oSelect.Label_ := 'Country';
oSelect.Placeholder := 'Select a country';
oSelect.Size := ssLarge;
oSelect.AddOption('es', 'Spain', True);
oSelect.AddOption('fr', 'France');
oSelect.AddOptionGroup('Americas', 'us', 'United States');
WebModule.Response := oSelect.HTML; // Bootstrap form-select
finally
oSelect.Free;
end;
end;
// Or fill it straight from a dataset:
oSelect.LoadFromDataSet(qryCountries, 'Code', 'Name', 'Region');
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Select.hpp
TsgcHTMLComponent_Select *oSelect = new TsgcHTMLComponent_Select(NULL);
try
{
oSelect->Name = "country";
oSelect->Label_ = "Country";
oSelect->Placeholder = "Select a country";
oSelect->Size = ssLarge;
oSelect->AddOption("es", "Spain", true);
oSelect->AddOption("fr", "France");
oSelect->AddOptionGroup("Americas", "us", "United States");
String html = oSelect->HTML; // Bootstrap form-select
}
__finally
{
delete oSelect;
}
using esegece.sgcWebSockets;
var select = new TsgcHTMLComponent_Select();
select.Name = "country";
select.Label_ = "Country";
select.Placeholder = "Select a country";
select.Size = TsgcHTMLSelectSize.ssLarge;
select.AddOption("es", "Spain", true);
select.AddOption("fr", "France");
select.AddOptionGroup("Americas", "us", "United States");
string html = select.HTML; // Bootstrap form-select
가장 자주 사용하게 되는 멤버.
Options는 TsgcHTMLSelectOption의 컬렉션입니다(각각 Value, Text, Selected, Disabled 및 Group 보유). 편의 메서드 AddOption(value, text, selected)와 AddOptionGroup(group, value, text)가 이를 채웁니다.
Name은 필드 이름을, Label_은 캡션을, Placeholder는 비활성화된 선행 옵션을, SelectID는 요소 id를 설정합니다(기본값은 sel_<Name>).
Multiple은 이를 다중 선택 목록으로 만들고, VisibleItems는 한 번에 표시되는 행 수(size 속성)를 설정합니다.
Size는 TsgcHTMLSelectSize입니다 — ssDefault, ssSmall 또는 ssLarge.
LoadFromDataSet(aDataSet, aValueField, aTextField, aGroupField)는 쿼리에서 옵션을 채우며, 그룹 필드가 제공되면 <optgroup>을 구성합니다. 실시간 새로 고침을 위해 DataSource를 할당하십시오.
Required와 Disabled는 컨트롤을 표시합니다. HTML은 모든 옵션과 옵션 그룹을 갖춘 레이블이 있는 <select>를 반환합니다.