ImportAPI
(System Library)
Description: | Imports objects of class API from a given module, for use in the calling module. |
Returns: | Numeric |
Usage: | Script Only. |
Function Groups: | Advanced Module |
Related to: | TreeControl |
Format: | System.ImportAPI(SourceModule[, DestinationModule]) |
Parameters: |
SourceModule |
Required. Any expression for the module from which the API-class constants should be imported. |
DestinationModule |
An optional expression, giving the module that the API-class constants should be imported into. Used only if the constants are not being imported into the current module. |
Comments: | When using modules such as TreeControl, the ImportAPI function can reduce the programming workload by importing all the required constants with one command. Only those constants that have been declared as class API in the source module will be imported. ImportAPI "imports" the source objects by creating variables with the same name in the destination module and assigning to these the default values from the source module. Results may be unpredictable if more than one instance of the source module is found. Returns the number of variables that were found to have the same name in the calling module and that therefore were not imported from the source module. |
Example:
A selection of constants declared in TreeControl.SRC:
{***** Indices into the Tree array nodes *****} [ (API) Constant #TI_KEY = 0 { "Key" value...see heading comment }; Constant #TI_TEXT = 1 { Text value to display }; Constant #TI_SUBTREE = 2 { Subordinate tree below this node }; … etc …
Importing the TreeControl constants in DropTree.SRC:
Init [ If 1 DropTree; [ { Import the Tree Control API } System.ImportAPI(\TreeControl); … etc …