Popover

TsgcHTMLComponent_Popover — anexe um popover do Bootstrap 5 com título e corpo a qualquer elemento de gatilho, com posicionamento, gatilho e comportamento de dispensa configuráveis, em Delphi, C++ Builder e .NET.

TsgcHTMLComponent_Popover

Um componente popover que envolve um elemento de gatilho com atributos de dados popover do Bootstrap 5 e um script de inicialização automática. Defina o conteúdo, o título e o corpo e então leia a propriedade HTML — ou chame o helper estático Build para uma linha única.

Classe do componente

TsgcHTMLComponent_Popover

Renderiza

Markup de popover do Bootstrap 5

Linguagens

Delphi, C++ Builder, .NET

Construa em uma linha, ou configure-o por completo

Chame BuildButton(text, title, body, style, placement) para um botão popover, ou crie o componente, defina Placement e Trigger e então leia HTML.

uses
  sgcHTML_Enums, sgcHTML_Component_Popover;

// One-line static helper (primary form):
var
  vHTML: string;
begin
  vHTML := TsgcHTMLComponent_Popover.BuildButton('More info',
    'Pricing', 'All licenses include full source code.',
    bsPrimary, plTop);
  WebModule.Response := vHTML;
end;

// Or configure it fully:
var
  oPop: TsgcHTMLComponent_Popover;
begin
  oPop := TsgcHTMLComponent_Popover.Create(nil);
  try
    oPop.Content := '<a href="#" class="btn btn-info">Details</a>';
    oPop.Title := 'Shipping';
    oPop.Body := 'Free delivery on orders over 50.';
    oPop.Placement := plRight;
    oPop.Trigger := ptHover;
    oPop.Dismissible := True;

    WebModule.Response := oPop.HTML;   // trigger + popover init script
  finally
    oPop.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_Popover.hpp

// One-line static helper (primary form):
String html = TsgcHTMLComponent_Popover::BuildButton("More info",
  "Pricing", "All licenses include full source code.",
  bsPrimary, plTop);

// Or configure it fully:
TsgcHTMLComponent_Popover *oPop = new TsgcHTMLComponent_Popover(NULL);
try
{
  oPop->Content = "<a href=\"#\" class=\"btn btn-info\">Details</a>";
  oPop->Title = "Shipping";
  oPop->Body = "Free delivery on orders over 50.";
  oPop->Placement = plRight;
  oPop->Trigger = ptHover;
  oPop->Dismissible = true;

  String html = oPop->HTML;   // trigger + popover init script
}
__finally
{
  delete oPop;
}
using esegece.sgcWebSockets;

// One-line static helper (primary form):
string html = TsgcHTMLComponent_Popover.BuildButton("More info",
    "Pricing", "All licenses include full source code.",
    TsgcHTMLButtonStyle.bsPrimary, TsgcHTMLPlacement.plTop);

// Or configure it fully:
var pop = new TsgcHTMLComponent_Popover();
pop.Content = "<a href=\"#\" class=\"btn btn-info\">Details</a>";
pop.Title = "Shipping";
pop.Body = "Free delivery on orders over 50.";
pop.Placement = TsgcHTMLPlacement.plRight;
pop.Trigger = TsgcHTMLPopoverTrigger.ptHover;
pop.Dismissible = true;

string html = pop.HTML;   // trigger + popover init script

Principais propriedades & métodos

Os membros que você usa com mais frequência.

Conteúdo

Content é o HTML interno do elemento de gatilho; quando vazio, um botão estilizado construído a partir de Title e ContentStyle é usado.

Texto do popover

Title define o título do popover e Body o seu texto (o data-bs-content do Bootstrap).

Posicionamento

Placement posiciona o popover com plTop, plBottom, plLeft ou plRight via TsgcHTMLPlacement.

Gatilho

Trigger seleciona ptClick, ptHover, ptFocus ou ptManual; Dismissible o fecha no próximo clique externo.

Inicialização

AutoInit adiciona um script que chama new bootstrap.Popover para cada popover; substitua o script via InitScript.

Helpers estáticos & saída

Build(content, title, body, placement, trigger) e BuildButton(text, title, body, style, placement) retornam markup pronto; HTML emite o gatilho mais seu script de inicialização.

Continue explorando

Todos os Componentes sgcHTMLExplore a matriz completa de recursos com mais de 60 componentes.
Baixar Versão de Avaliação GratuitaA avaliação de 30 dias inclui os projetos de demonstração 60.HTML.
PreçosLicenças Single, Team e Site com código-fonte completo.

Pronto para Começar?

Baixe a versão de avaliação gratuita e comece a construir UIs web em Delphi, C++ Builder e .NET.