Modal
TsgcHTMLComponent_Modal — renderiza un diálogo modal de Bootstrap 5 con título, cuerpo, botones de pie, tamaños y un fondo centrado o estático, en Delphi, C++ Builder y .NET.
TsgcHTMLComponent_Modal — renderiza un diálogo modal de Bootstrap 5 con título, cuerpo, botones de pie, tamaños y un fondo centrado o estático, en Delphi, C++ Builder y .NET.
Un componente de diálogo modal que emite marcado modal de Bootstrap 5. Define el título, el cuerpo y el tamaño, añade botones de pie y luego lee la propiedad HTML — o llama al método estático Build para hacerlo en una sola línea.
TsgcHTMLComponent_Modal
Marcado modal de Bootstrap 5
Delphi, C++ Builder, .NET
Llama a Build(id, title, body, footer, size) para un modal rápido, o crea el componente, añade botones de pie con AddFooterButton y luego lee HTML. Combínalo con BuildTriggerButton para abrir el diálogo.
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
Los miembros que más vas a usar.
Title define la cabecera, Body contiene el contenido del diálogo y Footer recibe HTML de pie sin formato; ModalID es el id del elemento que usan los disparadores.
AddFooterButton(text, style, closeOnClick) añade un botón con estilo; pasa True en closeOnClick para cerrar el modal al hacer clic.
Size selecciona msDefault, msSmall, msLarge, msXLarge o msFullscreen mediante TsgcHTMLModalSize.
Centered centra el diálogo verticalmente, Scrollable permite desplazar un cuerpo largo, StaticBackdrop bloquea el cierre al hacer clic fuera y ShowClose activa o desactiva la X de la cabecera.
Build(id, title, body, footer, size) devuelve un modal listo; BuildTriggerButton(modalID, text, style) emite un botón que lo abre.
HTML devuelve el marcado modal de Bootstrap completo — sírvelo o asígnalo al BodyContent de una plantilla de página.