Komponent TimePicker — sgcHTML | eSeGeCe

TimePicker

TsgcHTMLComponent_TimePicker — renderuje natywne pole wyboru godziny HTML5 z opcjonalnymi granicami min i maks oraz dokładnością co do sekundy, w Delphi, C++ Builder i .NET.

TsgcHTMLComponent_TimePicker

Opisany etykietą komponent pola, który generuje pole Bootstrap form-control typu HTML5 time. Ustaw granice, a następnie odczytaj właściwość HTML (lub wywołaj statyczną metodę pomocniczą Build).

Klasa komponentu

TsgcHTMLComponent_TimePicker

Renderuje

Natywne pole HTML5 <input type="time">

Języki

Delphi, C++ Builder, .NET

Utwórz, ustaw granice, wyrenderuj

Ustaw FieldName, LabelText oraz granice MinTime/MaxTime, a następnie odczytaj HTML — lub wywołaj statyczną metodę pomocniczą Build dla jednej linii kodu.

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

Kluczowe właściwości i metody

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

Pole

Value wstępnie wypełnia pole; FieldName ustawia jego atrybut name; LabelText renderuje etykietę form-label.

Granice

MinTime i MaxTime ograniczają dostępny zakres za pomocą natywnych atrybutów min/max.

Dokładność

StepSeconds ustawia bezpośrednio atrybut step; ShowSeconds (domyślnie False) to skrót, który wymusza dokładność co do sekundy, gdy StepSeconds pozostaje na 0.

Walidacja i stan

Required i Disabled oznaczają natywne pole.

Rozmiar

Size (TsgcHTMLSize: hsExtraSmallhsExtraLarge, domyślnie hsMedium) odpowiada rozmiarom form-control-sm/form-control-lg z Bootstrap.

Metoda pomocnicza

Build(fieldName, labelText, value) zwraca znaczniki w jednej linii, bez konieczności zarządzania instancją.

Poznawaj dalej

Pomoc onlinePełna dokumentacja API i przewodnik użytkowania tego komponentu.
Wszystkie komponenty sgcHTMLPrzejrzyj pełną matrycę funkcji 80+ 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 pola wyboru daty i godziny do swojej aplikacji webowej w Delphi, C++ Builder lub .NET.