TimePicker
TsgcHTMLComponent_TimePicker — 渲染带有可选最小和最大边界及秒级精度的原生 HTML5 时间输入框,适用于 Delphi、C++ Builder 和 .NET。
TsgcHTMLComponent_TimePicker — 渲染带有可选最小和最大边界及秒级精度的原生 HTML5 时间输入框,适用于 Delphi、C++ Builder 和 .NET。
一个带标签的输入组件,生成 HTML5 time 类型的 Bootstrap form-control。设置边界,然后读取 HTML 属性(或调用静态 Build 辅助方法)。
TsgcHTMLComponent_TimePicker
原生 HTML5 <input type="time">
Delphi, C++ Builder, .NET
设置 FieldName、LabelText 和 MinTime/MaxTime 边界,然后读取 HTML — 或调用静态 Build 辅助方法一行完成。
uses
sgcHTML_Component_TimePicker;
var
oTime: TsgcHTMLComponent_TimePicker;
begin
oTime := TsgcHTMLComponent_TimePicker.Create(nil);
try
oTime.FieldName := 'appointment_time';
oTime.LabelText := 'Appointment time';
oTime.MinTime := '08:00';
oTime.MaxTime := '18:00';
oTime.Required := True;
WebModule.Response := oTime.HTML; // <input type="time">
finally
oTime.Free;
end;
end;
// Or the static one-liner (field name, label, value):
Result := TsgcHTMLComponent_TimePicker.Build('appointment_time', 'Appointment time');
// includes: sgcHTML_Component_TimePicker.hpp
TsgcHTMLComponent_TimePicker *oTime = new TsgcHTMLComponent_TimePicker(NULL);
try
{
oTime->FieldName = "appointment_time";
oTime->LabelText = "Appointment time";
oTime->MinTime = "08:00";
oTime->MaxTime = "18:00";
oTime->Required = true;
String html = oTime->HTML; // <input type="time">
}
__finally
{
delete oTime;
}
// Or the static one-liner:
String html = TsgcHTMLComponent_TimePicker::Build("appointment_time", "Appointment time");
using esegece.sgcWebSockets;
var time = new TsgcHTMLComponent_TimePicker();
time.FieldName = "appointment_time";
time.LabelText = "Appointment time";
time.MinTime = "08:00";
time.MaxTime = "18:00";
time.Required = true;
string html = time.HTML; // <input type="time">
// Or the static one-liner:
string html2 = TsgcHTMLComponent_TimePicker.Build("appointment_time", "Appointment time");
您最常使用的成员。
Value 预填充输入框;FieldName 设置其 name;LabelText 渲染一个 form-label。
MinTime 和 MaxTime 通过原生 min/max 属性限制可选范围。
StepSeconds 直接设置 step 属性;ShowSeconds(默认 False)是一个快捷方式,当 StepSeconds 保持为 0 时请求一秒级精度。
Required 和 Disabled 标记原生输入框。
Size(TsgcHTMLSize:hsExtraSmall…hsExtraLarge,默认 hsMedium)对应 Bootstrap 的 form-control-sm/form-control-lg。
Build(fieldName, labelText, value) 一行返回标记,无需管理实例。