TdxAICommandList.IndexOf(string) Method
Returns the index of the specified AI-powered command in the collection.
Declaration
function IndexOf(const AID: string): Integer;
Parameters
Name | Type | Description |
---|---|---|
AID | string | The target AI command identifier. |
Returns
Type | Description |
---|---|
Integer | Returns the index of the target command ( If no such command is present in the collection, this parameter returns |
Remarks
Command indexes indicate their positions in the UI. For example, an editor’s context menu lists all commands in the current list from top to bottom within the AI Assistant submenu:
You can call the IndexOf
function to identify the actual position (index) of an AI-powered command.
Code Example: Rearrange AI-Powered Commands
The following code example moves Explain and Proofread commands to the second and third positions in a context menu, respectively:
uses
dxRichEdit.Control, // Declares TdxRichEditControl
dxAI; // Declares AI-specific types
// ...
procedure TMyForm.dxRichEditControl1GetAICommands(Sender: TObject;
const AAICommands: TdxAICommandList);
var
ACommandIndex: Integer;
begin
ACommandIndex := AAICommands.IndexOf(TdxAICommandIDs.Explain);
AAICommands.Move(ACommandIndex, 1); // Moves "Explain" to the second position (after "Expand")
ACommandIndex := AAICommands.IndexOf(TdxAICommandIDs.Proofread);
AAICommands.Move(ACommandIndex, 2); // Moves "Proofread" to the third position (after "Explain")
end;
See Also