This script is used to specify what is displayed in the About Stonefield Query dialog. With this script, you can add your own custom information, such as the "Current database" setting shown in the image below.

Parameters
A reference to the Stonefield Query Application object.

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

<settings>
    <setting>
        <description>Setting Description</description>
        <value>Current value</value>
        <link>Yes or No</link>
        <linkexpr>Link expression</linkexpr>
    </setting>
    <setting>
        <description>Setting Description</description>
        <value>Current value</value>
        <link>Yes or No</link>
        <linkexpr>Link expression</linkexpr>
    </setting>
    ...
</settings>

The following elements are available:

  • description: the description for the setting (the text in the left column of the settings grid in the About dialog).

  • value: the current value for the setting (displayed in the right column of the grid).

  • link: (optional) Yes if the user can click this setting to perform some action (an example is clicking a "Support email" setting to bring up a New Message email dialog with the support email address filled in) or No if this setting is not linked to any action (the default if this element is omitted).

  • linkexpr: (optional) the expression to execute when the user clicks the setting in the About dialog. If the link element is Yes and this element is empty or omitted, the About dialog performs a ShellExecute on the current value of the setting. For example, if the setting is a folder name and linkexpr isn't specified, when the user clicks the setting, Windows Explorer is launched, showing the contents of that folder; this is the behavior of ShellExecute when a folder name is specified. In the case of a URL, the user's default browser is launched. In the case of a document (such as a Microsoft Word or Excel document), the application associated with that document's extension is launched and the file is opened.

However, if you want something different to occur, such as calling a script or an external application, specify that for this element.

Example
Here's an example that adds the name of the current database and ODBC driver used to access it to the list of settings in the About dialog:

Visual FoxPro

lparameters toApplication as SQApplication
local loDatabase as Database, lcXML
loDatabase = toApplication.DataEngine.Databases.GetMainDatabase()
lcXML = '<settings>' + ;
  '<setting>' + ;
  '<description>Current database</description>' + ;
  '<value>' + loDatabase.DataSourceName + ' (' + ;
    loDatabase.CurrentDataSource.Driver + ')</value>' + ;
  '</setting>' + ;
  '</settings>'
return lcXML

VBScript

function Main(Application)
dim MainDatabase
set MainDatabase = Application.DataEngine.Databases.GetMainDatabase()
Main = "<settings>" & _
  "<setting>" & _
  "<description>Current database</description>" & _
  "<value>" & MainDatabase.DataSourceName & " (" & _
    MainDatabase.CurrentDataSource.Driver & ")</value>" & _
  "</setting>" & _
  "</settings>"
end function

JavaScript

function Main(Application) {
var MainDatabase = Application.DataEngine.Databases.GetMainDatabase() ;
var cXML = "<settings>" +
  "<setting>" +
  "<description>Current database</description>" +
  "<value>" + MainDatabase.DataSourceName + " (" +
  MainDatabase.CurrentDataSource.Driver + ")</value>" +
  "</setting>" +
  "</settings>" ;
return cXML ;
}

C#

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

public static string About_Settings(SFQApplication sfqApplication)
{
  StringBuilder XMLSettings = new StringBuilder("");

  Database mainDatabase = sfqApplication.DataEngine.Databases.GetMainDatabase();
	
  XMLSettings.Append("<settings>");
  XMLSettings.Append("<setting>");
  XMLSettings.Append("<description>Current database</description>");
  XMLSettings.Append("<value>" + mainDatabase.DataSourceName + " (" +
    mainDatabase.CurrentDataSource.Driver + ")");
  XMLSettings.Append("</value>");
  XMLSettings.Append("</setting>");
  XMLSettings.Append("</settings>");
				
  return XMLSettings.ToString();
}

VB.NET

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

public shared function About_Settings(sfqApplication as SFQApplication) as string

  Dim XMLSettings As StringBuilder = New StringBuilder("")

  Dim mainDatabase as Database = sfqApplication.DataEngine.Databases.GetMainDatabase()
	
  XMLSettings.Append("<settings>")
  XMLSettings.Append("<setting>")
  XMLSettings.Append("<description>Current database</description>")
  XMLSettings.Append("<value>" + mainDatabase.DataSourceName + " (" + _
    mainDatabase.CurrentDataSource.Driver + ")")
  XMLSettings.Append("</value>")
  XMLSettings.Append("</setting>")
  XMLSettings.Append("</settings>")

  return XMLSettings.ToString()

End Function

This code calls the GetMainDatabase method of the Databases collection of the DataEngine object of the passed Application object to return a Database object containing properties for the main database. It then builds an XML string with a single setting: the current database name and the driver used to access it. The DataSourceName property of the Database object contains the former and the Driver property of the CurrentDataSource member contains the latter. The XML string is then returned.

See also

Scripts

© Stonefield Software Inc., 2023 • Updated: 06/07/16
Comment or report problem with topic