Toast

TsgcHTMLComponent_Toast — Delphi, C++ Builder ve .NET'te konumlandırılmış bir kapsayıcıyla ekranda yerleştirilen, başlık, gövde, zaman damgası, renk ve otomatik gizlemeye sahip bir Bootstrap 5 toast bildirimi işleyin.

TsgcHTMLComponent_Toast

Bootstrap 5 toast işaretlemesi üreten bir toast bileşeni. Başlığı, gövdeyi ve rengi ayarlayın, ardından HTML özelliğini okuyun — ya da statik Build yardımcısını çağırın ve toast'ları konumlandırılmış bir BuildContainer içine sarın.

Bileşen sınıfı

TsgcHTMLComponent_Toast

İşler

Bootstrap 5 toast işaretlemesi

Diller

Delphi, C++ Builder, .NET

Tek satırda oluşturun ya da tam olarak yapılandırın

Hızlı bir toast için Build(title, body, color, timestamp)'i çağırın ve onu BuildContainer(toasts, position) içine sarın ya da bileşeni oluşturun, AutoHide ve Delay'i ayarlayın, ardından HTML'i okuyun.

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

Temel özellikler & yöntemler

En sık başvurduğunuz üyeler.

İçerik

Title, başlık metnini, Body, mesajı, Timestamp, küçük zaman etiketini ve Icon, başlıktan önce satır içi bir simgeyi ayarlar.

Renk

ColorStyle, bir TsgcHTMLColor alır (hcSuccess veya hcDanger gibi); Color, ham bir Bootstrap renk adı dizesi kabul eder.

Otomatik gizleme

AutoHide, toast'ı Delay milisaniye sonra otomatik olarak kapatır (varsayılan 5000); sabit tutmak için AutoHideFalse yapın.

Kimlik

ToastID, belirli bir toast'ı JavaScript'ten gösterebilmeniz veya gizleyebilmeniz için öğe kimliğini atar.

Statik yardımcılar

Build(title, body, color, timestamp), bir toast döndürür; BuildContainer(toasts, position), onları sabit bir toast-container (TsgcHTMLToastPosition) içine sarar.

Çıktı

HTML, eksiksiz Bootstrap toast işaretlemesini döndürür — sunun ya da bir sayfa şablonunun BodyContent'ine atayın.

Keşfetmeye devam edin

Tüm sgcHTML Bileşenleri60'tan fazla bileşenin tam özellik matrisine göz atın.
Ücretsiz Deneme Sürümünü İndirin30 günlük deneme, 60.HTML demo projeleriyle birlikte gelir.
FiyatlandırmaTam kaynak kodlu Single, Team ve Site lisansları.

Başlamaya Hazır mısınız?

Ücretsiz deneme sürümünü indirin ve Delphi, C++ Builder ve .NET'te web arayüzleri oluşturmaya başlayın.