TFmxHelpChatAI reference
Unit FMX.HelpChatAI · package HelpChatAIFmx · palette group Ethea HelpChatAI · Delphi 12 and later.
The FireMonkey twin of TVclHelpChatAI: same engine, same page, same events. Only what FireMonkey does differently is different.
Published properties
| Property | Type | Default | Description |
|---|---|---|---|
Settings | THelpChatSettings | See the Settings reference | |
Active | Boolean | False | Starts engine, transport and hooks |
RegisterHelpViewer | Boolean | True | Register with System.HelpIntfs, for code that calls the help system |
HandleF1 | Boolean | True | F1 on the host form opens the chat (its OnKeyDown is chained) |
Caption | string | (empty) | Title of the window the chat opens in when it is not embedded. Empty = the localized "Help" / "Aiuto" |
AssistantName | string | (empty) | What the assistant is called, written in the header of the panel next to its icon. Empty = the localized "Assistant" / "Assistente" |
ShowBubble | Boolean | True | The round button with the assistant icon, in the bottom-right corner of the host form |
Images | TCustomImageList | nil | Image list holding the bubble icon; nil uses the icons compiled into the component. The same icon is drawn in the header of the chat panel |
ImageIndex | TImageIndex | -1 | The icon by position. With no image list of your own it picks among the built-in ones |
ImageName | string | (empty) | The icon by name: AIAssistant_Male, AIAssistant_Female, Assistant_Male, Assistant_Female. The Object Inspector drops down the four |
ConfigFileName | TFileName | (empty) | The configuration file. Empty = merge the three standard helpchatai.json on activation; named = that one and nothing else, raising EHelpChatConfigError if it is not there |
ActionsEnabled | Boolean | True | Offer the registered actions to the model |
RememberPanelPosition | Boolean | True | Reopen the own window where the user left it |
ThemeMode | TFmxHelpChatThemeMode | tmAuto | tmAuto (page defaults, following the system), tmLight, tmDark |
Container | TFmxObject | nil | Where the chat is embedded; nil = the component's own window |
PanelWidth | Integer | 400 | Size of the own window |
PanelHeight | Integer | 600 |
Published events
Identical to the VCL ones, except that OnBeforeShowHelp carries a TFmxObject:
| Event | Signature |
|---|---|
OnGetContext | (Sender; var AContext: THelpChatContext) |
OnGetTheme | (Sender; var ATheme: THelpChatTheme) |
OnBeforeShowHelp | (Sender; var AContainer: TFmxObject) |
OnAfterShowHelp / OnBeforeHideHelp / OnAfterHideHelp | (Sender) |
OnActionConfirm | (Sender; const AName; const AArgs; var AAllow) |
OnActionExecuted | (Sender; const AName; const AOutcome; const AResult) |
Confirmation is not optional in FMX
With no OnActionConfirm, an action marked Confirm is refused: there is no dialog that can be waited for on every FireMonkey platform, and a worker thread is waiting for the answer.
Methods
Same as the VCL — Open, OpenForCurrentScreen, OpenForHelp, OpenWithQuestion, Close, Toggle, IsPanelVisible, BuildContext, BuildTheme, ApplyTheme — plus:
| Method | Description |
|---|---|
HandleKeyDown(var AKey: Word; const AShift: TShiftState): Boolean | Call it from the OnKeyDown of any other form to give it F1 too. Returns True when it consumed the key |
Public properties
Actions, Engine, Transport, ActiveContainer as in the VCL; View is a TFmxHelpChatPanel and OwnForm a TFmxHelpChatForm. HostForm (TCommonCustomForm) is public and not published, as in the VCL: set it in code, because at design time there would be nothing to choose from.
Minimal example
uses HelpChatAI.Types, FMX.HelpChatAI;
procedure TMainForm.FormCreate(Sender: TObject);
begin
HelpChatAI.Settings.Provider := 'docsearch';
HelpChatAI.Settings.DocIndexFile := TPath.Combine(
TPath.GetDirectoryName(ParamStr(0)), 'help-index.json');
HelpChatAI.ThemeMode := tmAuto;
HelpChatAI.Active := True;
end;
procedure TMainForm.FormKeyDown(Sender: TObject; var Key: Word;
var KeyChar: WideChar; Shift: TShiftState);
begin
HelpChatAI.HandleKeyDown(Key, Shift);
end;Platform notes
- Windows: WebView2 (
WindowsEngine = EdgeOnly), verified. - macOS, iOS, Android: the native web view; the code compiles but has not been tested yet.
- Delphi 12: a navigation outside the panel cannot be cancelled (
OnShouldLoadURLarrived in Delphi 13), so an external link opens in the system browser and the panel returns to its own page. - On mobile, use a remote server: no local HTTP server, no key in the package.