Six New sgcHTML Form Inputs: MultiSelect, ColorPicker, Slider, TimePicker, SignaturePad and Transfer | eSeGeCe Blog

Six New sgcHTML Form Inputs: MultiSelect, ColorPicker, Slider, TimePicker, SignaturePad and Transfer

· Components
Six New sgcHTML Form Inputs: MultiSelect, ColorPicker, Slider, TimePicker, SignaturePad and Transfer

Third post in this series on sgcHTML's 25 new components. This time it's forms: six inputs that show up in almost every admin screen you've ever had to build by hand — a tag picker, a colour swatch, a range slider, a time field, a signature capture, and a dual-list role assigner. Every one is a normal Delphi/C++Builder/.NET component: configure it, read HTML, and it posts back through the same request cycle as any other form field.

MultiSelect — a tag picker with chips

TsgcHTMLComponent_MultiSelect is a searchable dropdown that lets a visitor pick several values, shown as removable chips, with an optional MaxSelections cap. Add options one at a time or bind a dataset directly.

uses
  sgcHTML_Component_MultiSelect;

var
  oMulti: TsgcHTMLComponent_MultiSelect;
begin
  oMulti := TsgcHTMLComponent_MultiSelect.Create(nil);
  try
    oMulti.FieldName := 'tags';
    oMulti.Placeholder := 'Select tags';
    oMulti.MaxSelections := 3;
    oMulti.Size := mssLarge;

    oMulti.AddOption('js', 'JavaScript', True);
    oMulti.AddOption('py', 'Python');
    oMulti.AddOption('pas', 'Pascal');

    WebModule.Response := oMulti.HTML;   // dropdown + chips + hidden inputs
  finally
    oMulti.Free;
  end;
end;

// Or fill it straight from a dataset:
oMulti.LoadFromDataSet(qryTags, 'Code', 'Name', 'IsSelected');

ColorPicker — native input plus one-click presets

TsgcHTMLComponent_ColorPicker wraps the native HTML5 colour input with an optional hex text field and a row of one-click swatch presets — useful for anything from a brand-colour setting to a calendar-event tag colour.

uses
  sgcHTML_Component_ColorPicker;

var
  oColor: TsgcHTMLComponent_ColorPicker;
begin
  oColor := TsgcHTMLComponent_ColorPicker.Create(nil);
  try
    oColor.FieldName := 'brand_color';
    oColor.LabelText := 'Brand color';
    oColor.Value := '#0d6efd';
    oColor.ShowValueInput := True;

    oColor.Swatches.Add('#0d6efd');
    oColor.Swatches.Add('#198754');
    oColor.Swatches.Add('#dc3545');

    WebModule.Response := oColor.HTML;   // color input + hex field + swatches
  finally
    oColor.Free;
  end;
end;

// Or the static one-liner (field name, value, label):
Result := TsgcHTMLComponent_ColorPicker.Build('brand_color', '#0d6efd', 'Brand color');

Slider — a range input with a live value badge

TsgcHTMLComponent_Slider is a Bootstrap range slider with min/max labels and a badge that tracks the current value as it's dragged, coloured to match your theme.

uses
  sgcHTML_Enums, sgcHTML_Component_Slider;

var
  oSlider: TsgcHTMLComponent_Slider;
begin
  oSlider := TsgcHTMLComponent_Slider.Create(nil);
  try
    oSlider.FieldName := 'volume';
    oSlider.LabelText := 'Volume';
    oSlider.Min := 0;
    oSlider.Max := 100;
    oSlider.Step := 5;
    oSlider.Value := 50;
    oSlider.ShowMinMax := True;
    oSlider.ColorStyle := hcSuccess;

    WebModule.Response := oSlider.HTML;   // form-range + live value badge
  finally
    oSlider.Free;
  end;
end;

TimePicker — bounded time entry

TsgcHTMLComponent_TimePicker is a native time input with configurable MinTime/MaxTime bounds — the appointment-booking, opening-hours, shift-scheduling field. It has a static Build helper too.

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

SignaturePad — canvas signature capture

TsgcHTMLComponent_SignaturePad renders a pointer-events canvas with Clear, Undo and Save buttons, configurable pen colour and width, and an UploadURL the captured image posts to. Delivery approvals, contract sign-off, waiver forms — anywhere a wet signature became a screen tap.

uses
  sgcHTML_Component_SignaturePad;

var
  oPad: TsgcHTMLComponent_SignaturePad;
begin
  oPad := TsgcHTMLComponent_SignaturePad.Create(nil);
  try
    oPad.FieldName := 'signature';
    oPad.Width := 500;
    oPad.Height := 220;
    oPad.PenColor := '#1a1a2e';
    oPad.PenWidth := 3;
    oPad.UploadURL := '/api/signatures/upload';

    WebModule.Response := oPad.HTML;   // <canvas> + Clear/Undo/Save buttons
  finally
    oPad.Free;
  end;
end;

Transfer — the dual-list role assigner

TsgcHTMLComponent_Transfer is the classic two-panel widget for moving items between "available" and "assigned" — permissions, roles, group membership. ShowFilter adds a search box to each panel, and FieldName makes the assigned side post back as hidden inputs, so the form submit just works.

uses
  sgcHTML_Component_Transfer;

var
  oTransfer: TsgcHTMLComponent_Transfer;
begin
  oTransfer := TsgcHTMLComponent_Transfer.Create(nil);
  try
    oTransfer.TransferID := 'roles';
    oTransfer.FieldName := 'roles';
    oTransfer.TitleSource := 'Available roles';
    oTransfer.TitleTarget := 'Assigned roles';
    oTransfer.ShowFilter := True;
    oTransfer.Height := '260px';

    oTransfer.AddItem('admin', 'Administrator');
    oTransfer.AddItem('editor', 'Editor', True);
    oTransfer.AddItem('viewer', 'Viewer');

    WebModule.Response := oTransfer.HTML;   // dual panels + buttons + script
  finally
    oTransfer.Free;
  end;
end;

// Or bind it straight to a dataset:
oTransfer.LoadFromDataSet(qryRoles, 'RoleId', 'RoleName', 'IsAssigned');

Try them

Full documentation, key-property references and Delphi/C++Builder/.NET code samples live on each component's own page: MultiSelect, ColorPicker, Slider, TimePicker, SignaturePad and Transfer. Next up: badges, PDF viewing, and the components that make a busy screen feel responsive.

Questions, feedback or migration help? Get in touch — you will get a reply from the people who wrote the code.