Notification
TsgcHTMLComponent_Notification — affichez un centre de notifications déroulant à icône cloche avec un badge de non-lus, construit à partir d'une collection d'éléments de notification, en Delphi, C++ Builder et .NET.
TsgcHTMLComponent_Notification — affichez un centre de notifications déroulant à icône cloche avec un badge de non-lus, construit à partir d'une collection d'éléments de notification, en Delphi, C++ Builder et .NET.
Un composant de centre de notifications qui émet un menu déroulant Bootstrap 5. Ajoutez des éléments à sa collection Items (ou appelez AddNotification), puis lisez la propriété HTML — le UnreadCount de non-lus pilote le badge.
TsgcHTMLComponent_Notification
Du balisage de menu déroulant Bootstrap 5
Delphi, C++ Builder, .NET
Définissez Title et MaxVisible, appelez AddNotification(title, message, color, timestamp) pour chaque entrée, puis lisez HTML. Le nombre de non-lus remplit le badge automatiquement.
uses
sgcHTML_Enums, sgcHTML_Component_Notification;
var
oNotif: TsgcHTMLComponent_Notification;
begin
oNotif := TsgcHTMLComponent_Notification.Create(nil);
try
oNotif.Title := 'Notifications';
oNotif.MaxVisible := 5;
oNotif.ShowBadge := True;
oNotif.AddNotification('New order',
'Order #1042 was placed.', hcSuccess, '2 min ago');
oNotif.AddNotification('Payment failed',
'Invoice #88 could not be charged.', hcDanger, '10 min ago');
WebModule.Response := oNotif.HTML; // bell dropdown + badge
finally
oNotif.Free;
end;
end;
// Or add items via the Items collection directly:
with oNotif.Items.Add do
begin
Title := 'Welcome';
Message := 'Your account is ready.';
Color := hcInfo;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Notification.hpp
TsgcHTMLComponent_Notification *oNotif = new TsgcHTMLComponent_Notification(NULL);
try
{
oNotif->Title = "Notifications";
oNotif->MaxVisible = 5;
oNotif->ShowBadge = true;
oNotif->AddNotification("New order",
"Order #1042 was placed.", hcSuccess, "2 min ago");
oNotif->AddNotification("Payment failed",
"Invoice #88 could not be charged.", hcDanger, "10 min ago");
String html = oNotif->HTML; // bell dropdown + badge
}
__finally
{
delete oNotif;
}
// Or add items via the Items collection directly:
TsgcHTMLNotificationItem *item = oNotif->Items->Add();
item->Title = "Welcome";
item->Message = "Your account is ready.";
item->Color = hcInfo;
using esegece.sgcWebSockets;
var notif = new TsgcHTMLComponent_Notification();
notif.Title = "Notifications";
notif.MaxVisible = 5;
notif.ShowBadge = true;
notif.AddNotification("New order",
"Order #1042 was placed.", TsgcHTMLColor.hcSuccess, "2 min ago");
notif.AddNotification("Payment failed",
"Invoice #88 could not be charged.", TsgcHTMLColor.hcDanger, "10 min ago");
string html = notif.HTML; // bell dropdown + badge
// Or add items via the Items collection directly:
var item = notif.Items.Add();
item.Title = "Welcome";
item.Message = "Your account is ready.";
item.Color = TsgcHTMLColor.hcInfo;
Les membres que vous utilisez le plus souvent.
Items est une collection TsgcHTMLNotificationItems ; chaque TsgcHTMLNotificationItem possède Title, Message, Timestamp, Color, Icon, Href et Read.
AddNotification(title, message, color, timestamp) ajoute un élément et fixe par défaut l'horodatage à l'heure actuelle lorsqu'il est omis.
UnreadCount compte les éléments dont Read est False ; ShowBadge active la pilule rouge et GetBadgeHTML renvoie uniquement le balisage du badge.
Title définit l'en-tête du menu déroulant, EmptyText l'espace réservé lorsqu'il n'y a aucun élément et BellIcon le glyphe du déclencheur.
MaxVisible plafonne le nombre d'éléments rendus (5 par défaut), avec un lien « Tout voir » lorsqu'il y en a plus ; NotificationID attribue l'identifiant de l'élément.
HTML renvoie le menu déroulant à icône cloche complet avec son CSS dédié — 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 |