Toast
TsgcHTMLComponent_Toast — renderiza una notificación toast de Bootstrap 5 con título, cuerpo, marca de tiempo, color y autocierre, colocada en pantalla por un contenedor posicionado, en Delphi, C++ Builder y .NET.
TsgcHTMLComponent_Toast — renderiza una notificación toast de Bootstrap 5 con título, cuerpo, marca de tiempo, color y autocierre, colocada en pantalla por un contenedor posicionado, en Delphi, C++ Builder y .NET.
Un componente toast que emite marcado toast de Bootstrap 5. Define el título, el cuerpo y el color y luego lee la propiedad HTML — o llama al método estático Build y envuelve los toasts en un BuildContainer posicionado.
TsgcHTMLComponent_Toast
Marcado toast de Bootstrap 5
Delphi, C++ Builder, .NET
Llama a Build(title, body, color, timestamp) para un toast rápido y envuélvelo en BuildContainer(toasts, position), o crea el componente, define AutoHide y Delay y luego lee HTML.
uses
sgcHTML_Enums, sgcHTML_Component_Toast;
// One-line static helper (primary form):
var
vToast: string;
begin
vToast := TsgcHTMLComponent_Toast.Build('Saved',
'Your changes were stored.', hcSuccess, 'just now');
WebModule.Response := TsgcHTMLComponent_Toast.BuildContainer(vToast,
tpTopEnd);
end;
// Or configure it fully:
var
oToast: TsgcHTMLComponent_Toast;
begin
oToast := TsgcHTMLComponent_Toast.Create(nil);
try
oToast.ToastID := 'saveToast';
oToast.Title := 'Saved';
oToast.Body := 'Your changes were stored.';
oToast.ColorStyle := hcSuccess;
oToast.Timestamp := 'just now';
oToast.AutoHide := True;
oToast.Delay := 4000;
WebModule.Response := oToast.HTML; // Bootstrap toast markup
finally
oToast.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Toast.hpp
// One-line static helper (primary form):
String toast = TsgcHTMLComponent_Toast::Build("Saved",
"Your changes were stored.", hcSuccess, "just now");
String html = TsgcHTMLComponent_Toast::BuildContainer(toast, tpTopEnd);
// Or configure it fully:
TsgcHTMLComponent_Toast *oToast = new TsgcHTMLComponent_Toast(NULL);
try
{
oToast->ToastID = "saveToast";
oToast->Title = "Saved";
oToast->Body = "Your changes were stored.";
oToast->ColorStyle = hcSuccess;
oToast->Timestamp = "just now";
oToast->AutoHide = true;
oToast->Delay = 4000;
String body = oToast->HTML; // Bootstrap toast markup
}
__finally
{
delete oToast;
}
using esegece.sgcWebSockets;
// One-line static helper (primary form):
string toast = TsgcHTMLComponent_Toast.Build("Saved",
"Your changes were stored.", TsgcHTMLColor.hcSuccess, "just now");
string html = TsgcHTMLComponent_Toast.BuildContainer(toast,
TsgcHTMLToastPosition.tpTopEnd);
// Or configure it fully:
var t = new TsgcHTMLComponent_Toast();
t.ToastID = "saveToast";
t.Title = "Saved";
t.Body = "Your changes were stored.";
t.ColorStyle = TsgcHTMLColor.hcSuccess;
t.Timestamp = "just now";
t.AutoHide = true;
t.Delay = 4000;
string body = t.HTML; // Bootstrap toast markup
Los miembros que más vas a usar.
Title define el texto de la cabecera, Body el mensaje, Timestamp la pequeña etiqueta de hora e Icon un icono en línea antes del título.
ColorStyle recibe un TsgcHTMLColor (como hcSuccess o hcDanger); Color acepta una cadena con el nombre de un color de Bootstrap sin formato.
AutoHide cierra el toast automáticamente tras Delay milisegundos (5000 por defecto); pon AutoHide en False para mantenerlo fijo.
ToastID asigna el id del elemento para que puedas mostrar u ocultar un toast concreto desde JavaScript.
Build(title, body, color, timestamp) devuelve un toast; BuildContainer(toasts, position) los envuelve en un toast-container fijo (TsgcHTMLToastPosition).
HTML devuelve el marcado toast de Bootstrap completo — sírvelo o asígnalo al BodyContent de una plantilla de página.