CommandPalette
TsgcHTMLComponent_CommandPalette — the Ctrl+K / Cmd+K overlay launcher familiar from VS Code, Slack and Linear, with substring-then-fuzzy filtering, categories and server-routed actions, in Delphi, C++ Builder and .NET.
TsgcHTMLComponent_CommandPalette — the Ctrl+K / Cmd+K overlay launcher familiar from VS Code, Slack and Linear, with substring-then-fuzzy filtering, categories and server-routed actions, in Delphi, C++ Builder and .NET.
Add entries with AddItem or Items.Add, then read the HTML property; Ctrl+K (or Cmd+K) opens the overlay, typing filters it, Enter activates the selection.
TsgcHTMLComponent_CommandPalette
Hidden Ctrl+K overlay + inline script
Delphi, C++ Builder, .NET
Entries are rendered as markup on the server, not shipped to the browser as JSON to filter client-side, so every caption is HTML-encoded exactly once.
uses
sgcHTML_Component_CommandPalette;
var
oPalette: TsgcHTMLComponent_CommandPalette;
begin
oPalette := TsgcHTMLComponent_CommandPalette.Create(nil);
try
oPalette.PaletteID := 'app_commands';
oPalette.AddItem('New Invoice', '/invoices/new', 'invoice:new', 'Create', 'Ctrl+N');
oPalette.AddItem('Customer Search', '/customers', '', 'Navigate');
with oPalette.Items.Add do
begin
Caption := 'Export Report';
Icon := 'bi bi-download';
DataAction := 'report:export';
Category := 'Actions';
end;
WebModule.Response := oPalette.HTML; // hidden overlay + inline script
finally
oPalette.Free;
end;
end;
// includes: sgcHTML_Component_CommandPalette.hpp
TsgcHTMLComponent_CommandPalette *oPalette = new TsgcHTMLComponent_CommandPalette(NULL);
try
{
oPalette->PaletteID = "app_commands";
oPalette->AddItem("New Invoice", "/invoices/new", "invoice:new", "Create", "Ctrl+N");
TsgcHTMLCommandItem *oItem = oPalette->Items->Add();
oItem->Caption = "Export Report";
oItem->Icon = "bi bi-download";
oItem->DataAction = "report:export";
oItem->Category = "Actions";
String html = oPalette->HTML; // hidden overlay + inline script
}
__finally
{
delete oPalette;
}
using esegece.sgcWebSockets;
var palette = new TsgcHTMLComponent_CommandPalette();
palette.PaletteID = "app_commands";
palette.AddItem("New Invoice", "/invoices/new", "invoice:new", "Create", "Ctrl+N");
var item = palette.Items.Add();
item.Caption = "Export Report";
item.Icon = "bi bi-download";
item.DataAction = "report:export";
item.Category = "Actions";
string html = palette.HTML; // hidden overlay + inline script
The members you reach for most often.
Collection of TsgcHTMLCommandItem entries: Caption, Description, Icon, Href, DataAction, Shortcut (display only), Category and Enabled.
Convenience method appending one entry and returning it, so you can still set Icon/Description afterward.
Single character plus modifiers; both Ctrl and Meta default True, so Ctrl+K and Cmd+K both open it out of the box.
Default 10; 0 shows every matching entry at once.
Default True, groups the list under headings in first-appearance order (not alphabetical).
Activating a command dispatches a sgc:command DOM event always, and pushes over the sgcHTMX WebSocket bridge or POSTs to Action when either is set.
| Online HelpFull API reference and usage guide for this component. | Open | |
| All sgcHTML ComponentsBrowse the full feature matrix of 80+ components. | Open | |
| Download Free TrialThe 30-day trial ships the 60.HTML demo projects. | Open | |
| PricingSingle, Team and Site licenses with full source code. | Open |