Toast
TsgcHTMLComponent_Toast — affichez une notification toast Bootstrap 5 avec un titre, un corps, un horodatage, une couleur et un masquage automatique, placée à l'écran par un conteneur positionné, en Delphi, C++ Builder et .NET.
TsgcHTMLComponent_Toast — affichez une notification toast Bootstrap 5 avec un titre, un corps, un horodatage, une couleur et un masquage automatique, placée à l'écran par un conteneur positionné, en Delphi, C++ Builder et .NET.
Un composant toast qui émet du balisage toast Bootstrap 5. Définissez le titre, le corps et la couleur, puis lisez la propriété HTML — ou appelez l'assistant statique Build et enveloppez les toasts dans un BuildContainer positionné.
TsgcHTMLComponent_Toast
Du balisage toast Bootstrap 5
Delphi, C++ Builder, .NET
Appelez Build(title, body, color, timestamp) pour un toast rapide et enveloppez-le dans BuildContainer(toasts, position), ou créez le composant, définissez AutoHide et Delay, puis lisez 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
Les membres que vous utilisez le plus souvent.
Title définit le texte d'en-tête, Body le message, Timestamp le petit libellé d'heure et Icon une icône en ligne avant le titre.
ColorStyle prend un TsgcHTMLColor (tel que hcSuccess ou hcDanger) ; Color accepte une chaîne de nom de couleur Bootstrap brut.
AutoHide ferme le toast automatiquement après Delay millisecondes (5000 par défaut) ; mettez AutoHide à False pour le garder épinglé.
ToastID attribue l'identifiant de l'élément pour que vous puissiez afficher ou masquer un toast spécifique depuis JavaScript.
Build(title, body, color, timestamp) renvoie un toast ; BuildContainer(toasts, position) les enveloppe dans un toast-container fixe (TsgcHTMLToastPosition).
HTML renvoie le balisage toast Bootstrap complet — servez-le, ou affectez-le au BodyContent d'un modèle de page.
| Tous les composants sgcHTMLParcourez la matrice complète des fonctionnalités de plus de 60 composants. | Ouvrir | |
| Télécharger la version d'essai gratuiteLa version d'essai de 30 jours fournit les projets de démonstration 60.HTML. | Ouvrir | |
| TarifsLicences Single, Team et Site avec code source complet. | Ouvrir |