Toast

TsgcHTMLComponent_Toast — Delphi, C++ Builder 및 .NET에서 제목, 본문, 타임스탬프, 색상 및 자동 숨김을 갖춘 Bootstrap 5 토스트 알림을 위치가 지정된 컨테이너로 화면에 배치하여 렌더링합니다.

TsgcHTMLComponent_Toast

Bootstrap 5 toast 마크업을 내보내는 토스트 컴포넌트입니다. 제목, 본문 및 색상을 설정한 다음, HTML 속성을 읽습니다 — 또는 정적 Build 헬퍼를 호출하고 토스트를 위치가 지정된 BuildContainer로 감싸십시오.

컴포넌트 클래스

TsgcHTMLComponent_Toast

렌더링

Bootstrap 5 toast 마크업

언어

Delphi, C++ Builder, .NET

한 줄로 구성하거나, 완전하게 구성하기

빠른 토스트를 위해 Build(title, body, color, timestamp)를 호출하고 BuildContainer(toasts, position)로 감싸거나, 컴포넌트를 생성하고 AutoHide와 Delay를 설정한 다음, 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

주요 속성 및 메서드

가장 자주 사용하게 되는 멤버.

콘텐츠

Title은 헤더 텍스트를, Body는 메시지를, Timestamp는 작은 시간 레이블을, Icon은 제목 앞의 인라인 아이콘을 설정합니다.

색상

ColorStyle은 TsgcHTMLColor(예: hcSuccess 또는 hcDanger)를 받습니다. Color는 원시 Bootstrap 색상 이름 문자열을 받습니다.

자동 숨김

AutoHide는 Delay 밀리초(기본값 5000) 후에 토스트를 자동으로 닫습니다. 고정하려면 AutoHide를 False로 설정하십시오.

식별

ToastID는 JavaScript에서 특정 토스트를 표시하거나 숨길 수 있도록 요소 id를 할당합니다.

정적 헬퍼

Build(title, body, color, timestamp)는 토스트 하나를 반환합니다. BuildContainer(toasts, position)는 이를 고정된 toast-container(TsgcHTMLToastPosition)로 감쌉니다.

출력

HTML은 완전한 Bootstrap 토스트 마크업을 반환합니다 — 제공하거나, 페이지 템플릿의 BodyContent에 할당하십시오.

계속 살펴보기

온라인 도움말이 찱포넌트의 전체 API 참조 및 사용 가이드입니다.
모든 sgcHTML 컴포넌트80개 이상의 컴포넌트 전체 기능 매트릭스를 둘러보십시오.
무료 체험판 다운로드30일 체험판에는 60.HTML 데모 프로젝트가 포함됩니다.
가격전체 소스 코드가 포함된 Single, Team 및 Site 라이선스.
최고의 가성비: All-Access모든 eSeGeCe 제품과 프리미엄 지원이 포함되어 연 €1,059부터 이용할 수 있어요.
All-Access 가격 보기

시작할 준비가 되셨습니까?

무료 체험판을 다운로드하고 Delphi, C++ Builder 및 .NET에서 웹 UI를 구축하기 시작하십시오.