Class ScriptOptions : add Method
void add( String strID, String strName, String strType, String strDescription, String strDefault, [ String strIcon ], [ Integer nMinimum ], [ Integer nMaximum ], [ function function ], [ Boolean bHiddenFromUI ] ) |
Summary
Add a new option
Remarks
If you open lang.dgl in a text editor and search for IDS_ADVANCED_SETTINGS_JAVASCRIPT you'll see the code that adds all of DigiGuide's Advanced Settings.
Parameters
Parameter | Description |
String strID |
Unique ID for the option. This needs to be unique within the system otherwise the option will NOT be added. |
String strName |
Name for the option as it appears on the Advanced Settings window. e.g. "General: Go to Now when minimising" |
String strType |
Type of this option e.g. Type | Description | int | An integer, a number | string | A string | bool | A boolean, true/false value | date | A Date object | |
String strDescription |
Free form description as displayed on the Advanced Options page. Can contain basic HTML. |
String strDefault |
Default for this option for when the user has not changed it. |
String strIcon [optional] |
Image name for this icon. e.g. %DGIMAGEDIR%Toolbars.dgimglib:toolbar-view-grid.png |
Integer nMinimum [optional] |
For Int options you can specify an optional minimum when editing view the Advanced Options UI. |
Integer nMaximum [optional] |
For Int options you can specify an optional maximum when editing view the Advanced Options UI. |
function function [optional] |
For string or int types you can also specify an optional callback function to validate the content entered by the user. |
Boolean bHiddenFromUI [optional] |
True if you don't want the user to directly edit this option. |
|
|
|
Examples
function onValidateIntScriptOption( value ) { if( value > 0 && value < 11 ) { return ""; } return "Value must be between 1 and 10"; }
function onValidateStringScriptOption( value ) { if( value.length ) { return ""; } return "Need to enter a string"; }
var strOptionName = "test1" app.scriptOptions.add( strOptionName, "Hidden: Int test", "int", "Just an int with a validation", 1, "", null, null, onValidateIntScriptOption ); app.scriptOptions.add( "test2", "Hidden: String Test", "string", "Just a string with validation", "something", "", null, null, onValidateStringScriptOption );
|
See Also
ScriptOptions : remove
ScriptOptions : set
Requirements
1110
|