Notification
TsgcHTMLComponent_Notification — erzeugen Sie ein Glocken-Symbol-Dropdown als Benachrichtigungszentrale mit Ungelesen-Abzeichen, aufgebaut aus einer Sammlung von Benachrichtigungselementen, in Delphi, C++ Builder und .NET.
TsgcHTMLComponent_Notification — erzeugen Sie ein Glocken-Symbol-Dropdown als Benachrichtigungszentrale mit Ungelesen-Abzeichen, aufgebaut aus einer Sammlung von Benachrichtigungselementen, in Delphi, C++ Builder und .NET.
Eine Benachrichtigungszentralen-Komponente, die ein Bootstrap-5-Dropdown ausgibt. Fügen Sie Elemente zu ihrer Items-Sammlung hinzu (oder rufen Sie AddNotification auf) und lesen Sie dann die HTML-Eigenschaft — der Ungelesen-Wert UnreadCount steuert das Abzeichen.
TsgcHTMLComponent_Notification
Bootstrap-5-Dropdown-Markup
Delphi, C++ Builder, .NET
Setzen Sie Title und MaxVisible, rufen Sie AddNotification(title, message, color, timestamp) für jeden Eintrag auf und lesen Sie dann HTML. Der Ungelesen-Wert befüllt das Abzeichen automatisch.
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;
Die Member, die Sie am häufigsten verwenden.
Items ist eine TsgcHTMLNotificationItems-Sammlung; jedes TsgcHTMLNotificationItem hat Title, Message, Timestamp, Color, Icon, Href und Read.
AddNotification(title, message, color, timestamp) hängt ein Element an und setzt den Zeitstempel standardmäßig auf die aktuelle Zeit, wenn er weggelassen wird.
UnreadCount zählt Elemente, deren Read False ist; ShowBadge schaltet die rote Pille um und GetBadgeHTML gibt nur das Abzeichen-Markup zurück.
Title setzt die Dropdown-Überschrift, EmptyText den Platzhalter, wenn keine Elemente vorhanden sind, und BellIcon das Trigger-Symbol.
MaxVisible begrenzt, wie viele Elemente dargestellt werden (Standard 5), mit einem "View all"-Link, wenn mehr vorhanden sind; NotificationID weist die Element-id zu.
HTML gibt das vollständige Glocken-Symbol-Dropdown samt seines scoped CSS zurück — liefern Sie es aus oder weisen Sie es dem BodyContent einer Seitenvorlage zu.
| Alle sgcHTML-KomponentenDurchsuchen Sie die vollständige Funktionsmatrix von über 60 Komponenten. | Öffnen | |
| Kostenlose Testversion herunterladenDie 30-Tage-Testversion enthält die 60.HTML-Demoprojekte. | Öffnen | |
| PreiseSingle-, Team- und Site-Lizenzen mit vollständigem Quellcode. | Öffnen |