Modal

TsgcHTMLComponent_Modal — Delphi, C++ Builder ve .NET'te başlık, gövde, altbilgi düğmeleri, boyutlandırma ve ortalı veya sabit bir arka planla bir Bootstrap 5 modal iletişim kutusu işleyin.

TsgcHTMLComponent_Modal

Bootstrap 5 modal işaretlemesi üreten bir modal iletişim kutusu bileşeni. Başlığı, gövdeyi ve boyutu ayarlayın, altbilgi düğmeleri ekleyin, ardından HTML özelliğini okuyun — ya da tek satırlık çözüm için statik Build yardımcısını çağırın.

Bileşen sınıfı

TsgcHTMLComponent_Modal

İşler

Bootstrap 5 modal işaretlemesi

Diller

Delphi, C++ Builder, .NET

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

Hızlı bir modal için Build(id, title, body, footer, size)'i çağırın ya da bileşeni oluşturun, AddFooterButton ile altbilgi düğmeleri ekleyin, ardından HTML'i okuyun. İletişim kutusunu açmak için onu BuildTriggerButton ile eşleştirin.

uses
  sgcHTML_Enums, sgcHTML_Component_Modal;

// One-line static helper (primary form):
var
  vTrigger, vDialog: string;
begin
  vTrigger := TsgcHTMLComponent_Modal.BuildTriggerButton('confirmModal',
    'Delete account', bsDanger);
  vDialog := TsgcHTMLComponent_Modal.Build('confirmModal',
    'Please confirm', 'This action cannot be undone.',
    '', msDefault);
  WebModule.Response := vTrigger + vDialog;
end;

// Or configure it fully and add custom footer buttons:
var
  oModal: TsgcHTMLComponent_Modal;
begin
  oModal := TsgcHTMLComponent_Modal.Create(nil);
  try
    oModal.ModalID := 'confirmModal';
    oModal.Title := 'Please confirm';
    oModal.Body := 'This action cannot be undone.';
    oModal.Size := msLarge;
    oModal.Centered := True;
    oModal.StaticBackdrop := True;

    oModal.AddFooterButton('Cancel', bsSecondary, True);
    oModal.AddFooterButton('Delete', bsDanger);

    WebModule.Response := oModal.HTML;   // Bootstrap modal markup
  finally
    oModal.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Modal.hpp

// One-line static helper (primary form):
String trigger = TsgcHTMLComponent_Modal::BuildTriggerButton("confirmModal",
  "Delete account", bsDanger);
String dialog = TsgcHTMLComponent_Modal::Build("confirmModal",
  "Please confirm", "This action cannot be undone.",
  "", msDefault);

// Or configure it fully and add custom footer buttons:
TsgcHTMLComponent_Modal *oModal = new TsgcHTMLComponent_Modal(NULL);
try
{
  oModal->ModalID = "confirmModal";
  oModal->Title = "Please confirm";
  oModal->Body = "This action cannot be undone.";
  oModal->Size = msLarge;
  oModal->Centered = true;
  oModal->StaticBackdrop = true;

  oModal->AddFooterButton("Cancel", bsSecondary, true);
  oModal->AddFooterButton("Delete", bsDanger);

  String html = oModal->HTML;   // Bootstrap modal markup
}
__finally
{
  delete oModal;
}
using esegece.sgcWebSockets;

// One-line static helper (primary form):
string trigger = TsgcHTMLComponent_Modal.BuildTriggerButton("confirmModal",
    "Delete account", TsgcHTMLButtonStyle.bsDanger);
string dialog = TsgcHTMLComponent_Modal.Build("confirmModal",
    "Please confirm", "This action cannot be undone.",
    "", TsgcHTMLModalSize.msDefault);

// Or configure it fully and add custom footer buttons:
var modal = new TsgcHTMLComponent_Modal();
modal.ModalID = "confirmModal";
modal.Title = "Please confirm";
modal.Body = "This action cannot be undone.";
modal.Size = TsgcHTMLModalSize.msLarge;
modal.Centered = true;
modal.StaticBackdrop = true;

modal.AddFooterButton("Cancel", TsgcHTMLButtonStyle.bsSecondary, true);
modal.AddFooterButton("Delete", TsgcHTMLButtonStyle.bsDanger);

string html = modal.HTML;   // Bootstrap modal markup

Temel özellikler & yöntemler

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

İçerik

Title, başlığı ayarlar, Body, iletişim kutusu içeriğini tutar ve Footer, ham altbilgi HTML'ini alır; ModalID, tetikleyiciler tarafından kullanılan öğe kimliğidir.

Altbilgi düğmeleri

AddFooterButton(text, style, closeOnClick), biçimlendirilmiş bir düğme ekler; tıklandığında modalı kapatmak için closeOnClick olarak True geçirin.

Boyutlandırma

Size, TsgcHTMLModalSize aracılığıyla msDefault, msSmall, msLarge, msXLarge veya msFullscreen seçer.

Davranış

Centered, iletişim kutusunu dikey olarak ortalar, Scrollable, uzun bir gövdeyi kaydırır, StaticBackdrop, dışarı tıklayarak kapatmayı engeller ve ShowClose, başlıktaki X'i açıp kapatır.

Statik yardımcılar

Build(id, title, body, footer, size), hazır bir modal döndürür; BuildTriggerButton(modalID, text, style), onu açan bir düğme üretir.

Çıktı

HTML, eksiksiz Bootstrap modal 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.