Snackbar
TsgcHTMLComponent_Snackbar — Delphi, C++ Builder 및 .NET에서 선택적 작업 링크, 색상, 화면 위치 및 자동 숨김을 갖춘 머티리얼 스타일의 일시적 스낵바를 렌더링합니다.
TsgcHTMLComponent_Snackbar — Delphi, C++ Builder 및 .NET에서 선택적 작업 링크, 색상, 화면 위치 및 자동 숨김을 갖춘 머티리얼 스타일의 일시적 스낵바를 렌더링합니다.
범위 지정 CSS와 위치가 지정된 마크업 블록을 내보내는 스낵바 컴포넌트입니다. 메시지, 색상 및 위치를 설정한 다음, HTML 속성을 읽습니다 — 또는 한 줄짜리 정적 Build 헬퍼를 호출하십시오.
TsgcHTMLComponent_Snackbar
범위 지정 CSS + 스낵바 마크업
Delphi, C++ Builder, .NET
빠른 스낵바를 위해 Build(message, color, actionText, position)을 호출하거나, 컴포넌트를 생성하고 ActionHref, AutoHide 및 Delay를 설정한 다음, HTML을 읽습니다.
uses
sgcHTML_Enums, sgcHTML_Component_Snackbar;
// One-line static helper (primary form):
var
vHTML: string;
begin
vHTML := TsgcHTMLComponent_Snackbar.Build('Message sent.',
hcSuccess, 'Undo', sbBottomRight);
WebModule.Response := vHTML;
end;
// Or configure it fully:
var
oSB: TsgcHTMLComponent_Snackbar;
begin
oSB := TsgcHTMLComponent_Snackbar.Create(nil);
try
oSB.Message := 'Message sent.';
oSB.Color := hcSuccess;
oSB.Position := sbBottomRight;
oSB.ActionText := 'Undo';
oSB.ActionHref := '/undo';
oSB.AutoHide := True;
oSB.Delay := 4000;
WebModule.Response := oSB.HTML; // scoped CSS + snackbar markup
finally
oSB.Free;
end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Snackbar.hpp
// One-line static helper (primary form):
String html = TsgcHTMLComponent_Snackbar::Build("Message sent.",
hcSuccess, "Undo", sbBottomRight);
// Or configure it fully:
TsgcHTMLComponent_Snackbar *oSB = new TsgcHTMLComponent_Snackbar(NULL);
try
{
oSB->Message = "Message sent.";
oSB->Color = hcSuccess;
oSB->Position = sbBottomRight;
oSB->ActionText = "Undo";
oSB->ActionHref = "/undo";
oSB->AutoHide = true;
oSB->Delay = 4000;
String html = oSB->HTML; // scoped CSS + snackbar markup
}
__finally
{
delete oSB;
}
using esegece.sgcWebSockets;
// One-line static helper (primary form):
string html = TsgcHTMLComponent_Snackbar.Build("Message sent.",
TsgcHTMLColor.hcSuccess, "Undo", TsgcHTMLSnackbarPosition.sbBottomRight);
// Or configure it fully:
var sb = new TsgcHTMLComponent_Snackbar();
sb.Message = "Message sent.";
sb.Color = TsgcHTMLColor.hcSuccess;
sb.Position = TsgcHTMLSnackbarPosition.sbBottomRight;
sb.ActionText = "Undo";
sb.ActionHref = "/undo";
sb.AutoHide = true;
sb.Delay = 4000;
string html = sb.HTML; // scoped CSS + snackbar markup
가장 자주 사용하게 되는 멤버.
Message는 스낵바에 표시되는 텍스트입니다. SnackbarID는 JavaScript에서 이를 닫는 데 사용되는 요소 id를 할당합니다.
ActionText는 후행 작업 버튼을 추가합니다. ActionHref를 설정하면 링크가 되고, 그렇지 않으면 클릭 시 스낵바를 닫습니다.
Color는 TsgcHTMLColor(기본값 hcDark)를 받아 스낵바 배경에 색을 입힙니다.
Position은 sbBottom, sbTop, sbBottomLeft, sbBottomRight, sbTopLeft 또는 sbTopRight(TsgcHTMLSnackbarPosition)로 이를 배치합니다.
AutoHide는 내보낸 타임아웃 스크립트를 통해 Delay 밀리초(기본값 4000) 후에 스낵바를 제거합니다.
Build(message, color, actionText, position)은 준비된 스낵바를 반환합니다. HTML은 범위 지정 CSS, 슬라이드인 마크업 및 자동 숨김 스크립트를 내보냅니다.