Snackbar

TsgcHTMLComponent_Snackbar — Delphi, C++ Builder 및 .NET에서 선택적 작업 링크, 색상, 화면 위치 및 자동 숨김을 갖춘 머티리얼 스타일의 일시적 스낵바를 렌더링합니다.

TsgcHTMLComponent_Snackbar

범위 지정 CSS와 위치가 지정된 마크업 블록을 내보내는 스낵바 컴포넌트입니다. 메시지, 색상 및 위치를 설정한 다음, HTML 속성을 읽습니다 — 또는 한 줄짜리 정적 Build 헬퍼를 호출하십시오.

컴포넌트 클래스

TsgcHTMLComponent_Snackbar

렌더링

범위 지정 CSS + 스낵바 마크업

언어

Delphi, C++ Builder, .NET

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

빠른 스낵바를 위해 Build(message, color, actionText, position)을 호출하거나, 컴포넌트를 생성하고 ActionHref, AutoHideDelay를 설정한 다음, 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를 설정하면 링크가 되고, 그렇지 않으면 클릭 시 스낵바를 닫습니다.

색상

ColorTsgcHTMLColor(기본값 hcDark)를 받아 스낵바 배경에 색을 입힙니다.

위치

PositionsbBottom, sbTop, sbBottomLeft, sbBottomRight, sbTopLeft 또는 sbTopRight(TsgcHTMLSnackbarPosition)로 이를 배치합니다.

자동 숨김

AutoHide는 내보낸 타임아웃 스크립트를 통해 Delay 밀리초(기본값 4000) 후에 스낵바를 제거합니다.

정적 헬퍼 및 출력

Build(message, color, actionText, position)은 준비된 스낵바를 반환합니다. HTML은 범위 지정 CSS, 슬라이드인 마크업 및 자동 숨김 스크립트를 내보냅니다.

계속 살펴보기

모든 sgcHTML 컴포넌트60개 이상의 컴포넌트 전체 기능 매트릭스를 둘러보십시오.
무료 체험판 다운로드30일 체험판에는 60.HTML 데모 프로젝트가 포함됩니다.
가격전체 소스 코드가 포함된 Single, Team 및 Site 라이선스.

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

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