seAddCompletionItem()
Allows to add new auto-complete suggestions for the script editor.
Synopsis
int seAddCompletionItem(string displayText, string insertText = "", string
icon = "")
Parameters
Parameter | Description |
---|---|
displayText | Text to be displayed within the auto completion list |
insertText | Text to be inserted |
icon | Icon to be displayed inside of the auto-completion list entry |
Return value
If the entry was added successfully 0 and -1 in case of an error.
Description
The function allows to add a new entry to the auto-completion pop-up of the script editor. The displayText is the string shown in the completion list and used for matching what the user has already typed in the editor when the TAB key is pressed. When the item is selected from the completion list, then the given insertText is inserted into the script. If the insertText is not stated than the content of displayText is inserted instead.
The icon is a relative path to a file in any pictures subdirectory ((Sub-)project path or installation path).
The displayText can only start with a letter, a number, Underscore _ or @ character
Example
Following example code adds all example data points to the completion list of the script editor.
main()
{
seAddExampleDpsToCompletionItems();
}
seAddExampleDpsToCompletionItems()
{
dyn_string names = dpNames("Example*");
for(int i = 1; i <= dynlen(names); i++)
{
const string name = dpSubStr(names[i], DPSUB_DP);
if ( name == "" )
continue;
seAddCompletionItem("dp_" + name, "\"" + name + "\"");
}
}
This function allows to expand the script editor and it is not allowed to use it in another context. To retrieve the script from the Editor, use the existing functiongetScript() and to set it back, use the existing function setScript(). The extension scripts have to be located in <proj_dir>/scripts/scriptEditor directory and an saved with the extension "_ext.ctl". From there only they can be loaded and executed.
Assignment
Script Editor Extensions
Availability
CTRL