TTMSFNCToolBar.OnAnchorClick Event
Fires when the user clicks an HTML anchor in the toolbar label text.
API unit family: TMSFNCToolBar
Declaring type: TTMSFNCToolBar
Inherited from: TTMSFNCCustomToolBar
Syntax
OnAnchorClick: TTMSFNCToolBarAnchorClickEvent;
__property TTMSFNCToolBarAnchorClickEvent OnAnchorClick = {read=FOnAnchorClick, write=FOnAnchorClick};
Parameters
| Name | Description |
|---|---|
Sender |
The toolbar. |
AAnchor |
The href value of the anchor that was clicked. |
Usage examples
Handle an HTML anchor click in a toolbar caption
Adds a button whose HTML caption contains a link and responds to the anchor click.
procedure TForm1.AddHtmlButton;
begin
// Button and toolbar captions render HTML, including clickable anchors.
TMSFNCToolBar1.AddButton(-1, -1, '', '', 'Need <a href="help">help</a>?');
TMSFNCToolBar1.OnAnchorClick := ToolBarAnchorClick;
TMSFNCToolBar1.Build;
end;
procedure TForm1.ToolBarAnchorClick(Sender: TObject; AAnchor: string);
begin
// AAnchor is the href of the clicked link.
if AAnchor = 'help' then
ShowMessage('Opening help...');
end;
void __fastcall TForm1::AddHtmlButton()
{
// Button and toolbar captions render HTML, including clickable anchors.
TMSFNCToolBar1->AddButton(-1, -1, "", "", "Need <a href=\"help\">help</a>?");
TMSFNCToolBar1->OnAnchorClick = ToolBarAnchorClick;
TMSFNCToolBar1->Build();
}
void __fastcall TForm1::ToolBarAnchorClick(TObject *Sender, System::UnicodeString AAnchor)
{
// AAnchor is the href of the clicked link.
if (AAnchor == "help")
ShowMessage("Opening help...");
}