This script is used to specify additional options settings in the Options dialog (available from the Tools menu). With this script, you can add your own custom settings. Stonefield Query doesn't use these settings, but another of your scripts could, by calling either the GetRegistryValue or GetINIValue methods of the Application object (depending on where you decide to store the value) to retrieve the setting and then doing something with it. In the image below, the "Report on AR data" and "Location of AR data" options are custom settings.

You can validate the values the user enters in your custom settings by creating an Options.Validate script, and receive notification about changes when the user clicks the OK button by creating an Options.Changed script.

You may want to allow the user to assign values to these settings the first time they run Stonefield Query. In that case, use the same code you have in Options.Settings in a Setup.Settings script to have the custom settings appear in the Setup dialog as well. The best way to do that is to create a user-defined script with the necessary code and call that script from both Options.Settings and Setup.Settings.

Parameters
A reference to the Stonefield Query Application object.

Return Value
An XML string defining the settings to display in the Options dialog. The format for the XML is as follows:

<settings>
  <setting>
    <page>Page to display setting on</page>
    <description>Setting description</description>
    <caption>Caption for control</caption>
    <type>Type of control</type>
    <key>Registry key</key>
    <left>Left position of the control</left>
    <top>Top position of the control</top>
    <default>Default value</default>
    <encryptkey>Key to use for encryption</encryptkey>
    <filetype>File type</filetype>
    <filedesc>File type description</filedesc>
    <script>Script name</script>
    <restart>Yes or No</restart>
    <storage>Data or Registry</storage>
  </setting>
  <setting>
    <page>Page to display setting on</page>
    <description>Setting description</description>
    <caption>Caption for control</caption>
    <type>Type of control</type>
    <key>Registry key</key>
    <left>Left position of the control</left>
    <top>Top position of the control</top>
    <default>Default value</default>
    <encryptkey>Key to use for encryption</encryptkey>
    <filetype>File type</filetype>
    <filedesc>File type description</filedesc>
    <script>Script name</script>
    <restart>Yes or No</restart>
    <storage>Data or Registry</storage>
  </setting>
  ...
</settings>

The following elements are available:

Example
Here's an example that adds two new settings to the Options dialog: a Yes/No setting indicating whether the user can report on AR data, and a directory setting indicating the location of the AR data. These settings appear on a page titled "AR Settings." If the user changes the location setting, Stonefield Query restarts.

Visual FoxPro

lparameters toApplication as SQApplication
local lcXML
lcXML = '<settings>' + ;
  '<setting>' + ;
  '<page>AR Settings</page>' + ;
  '<description>These settings allow you to report on AR data.</description>' + ;
  '<caption>Report on AR data</caption>' + ;
  '<type>Checkbox</type>' + ;
  '<key>AR Data</key>' + ;
  '</setting>' + ;
  '<setting>' + ;
  '<page>AR Settings</page>' + ;
  '<caption>Location of AR data</caption>' + ;
  '<type>Directory</type>' + ;
  '<key>AR Location</key>' + ;
  '<restart>Yes</restart>' + ;
  '</setting>' + ;
  '</settings>'
return lcXML

VBScript

function Main(Application)
Main = "<settings>" & _
  "<setting>" & _
  "<page>AR Settings</page>" & _
  "<description>These settings allow you to report on AR data.</description>" & _
  "<caption>Report on AR data</caption>" & _
  "<type>Checkbox</type>" & _
  "<key>AR Data</key>" & _
  "</setting>" & _
  "<setting>" & _
  "<page>AR Settings</page>" & _
  "<caption>Location of AR data</caption>" & _
  "<type>Directory</type>" & _
  "<key>AR Location</key>" & _
  "<restart>Yes</restart>" & _
  "</setting>" & _
  "</settings>"
end function

JavaScript

function Main(Application) {
var XML ;
XML = "<settings>" + 
  "<setting>" + 
  "<page>AR Settings</page>" +
  "<description>These settings allow you to report on AR data.</description>" +
  "<caption>Report on AR data</caption>" + 
  "<type>Checkbox</type>" + 
  "<key>AR Data</key>" + 
  "</setting>" + 
  "<setting>" + 
  "<page>AR Settings</page>" +
  "<caption>Location of AR data</caption>" + 
  "<type>Directory</type>" + 
  "<key>AR Location</key>" + 
  "<restart>Yes</restart>" +
  "</setting>" + 
  "</settings>" ;
return cXML ;
}

C#

Please note that the method in this script must be named Options_Settings.

public static striig Options_Settings(SFQApplication sfqApplication)
{
  StringBuilder XMLSettings = new StringBuilder("");
  XMLSettings.Append("<settings>");
  XMLSettings.Append("<setting>");
  XMLSettings.Append("<page>AR Settings</page>");
  XMLSettings.Append("<description>These settings allow you to report on AR " + 
    "data.</description>");		
  XMLSettings.Append("<caption>Report on AR data</caption>" );
  XMLSettings.Append("<type>Checkbox</type>");	
  XMLSettings.Append("<key>AR Data</key>");	
  XMLSettings.Append("</setting>");
  XMLSettings.Append("<setting>");
  XMLSettings.Append("<page>AR Settings</page>");
  XMLSettings.Append("<caption>Location of AR data</caption>");
  XMLSettings.Append("<type>Directory</type>");
  XMLSettings.Append("<key>AR Location</key>");
  XMLSettings.Append("<restart>Yes</restart>");
  XMLSettings.Append("</setting>");
  XMLSettings.Append("</settings>");
  return XMLSettings.ToString();
}

VB.NET

Please note that the method in this script must be named Options_Settings.

public shared function Options_Settings(sfqApplication as SFQApplication) as string
  Dim XMLSettings As StringBuilder = new StringBuilder("")
  XMLSettings.Append("<settings>")
  XMLSettings.Append("<setting>")
  XMLSettings.Append("<page>AR Settings</page>")
  XMLSettings.Append("<description>These settings allow you to report on AR " + _
    "data.</description>")		
  XMLSettings.Append("<caption>Report on AR data</caption>" )
  XMLSettings.Append("<type>Checkbox</type>")	
  XMLSettings.Append("<key>AR Data</key>")	
  XMLSettings.Append("</setting>")
  XMLSettings.Append("<setting>")
  XMLSettings.Append("<page>AR Settings</page>")
  XMLSettings.Append("<caption>Location of AR data</caption>")
  XMLSettings.Append("<type>Directory</type>")
  XMLSettings.Append("<key>AR Location</key>")
  XMLSettings.Append("<restart>Yes</restart>")
  XMLSettings.Append("</setting>")
  XMLSettings.Append("</settings>")
  return XMLSettings.ToString()
End Function

See the topic for the GetRegistryValue method of the Application object for an example that uses these options.

See Also
Options.Changed | Options.Validate | Scripts | Setup.Settings