Back to Contents


Front End Functions

Summary:

See also: Interface built-in class


Basics

The BDL language provides a specific method to call functions defined in the front end that will be executed locally on the workstation where the front end resides. When you call a user function from BDL, you specify a module name and a function name. Input and output parameters can be passed/returned in order to transmit/receive values to/from the front end. A typical example is an "open file" dialog window that allows you to select a file from the front end workstation file system.

A set of standard front end functions is built-in by default in the front end. It is possible to write your own functions in order to extend the front end possibilities. For example, you can write a set of functions to wrap an existing API, such as Window DDE or OLE. A set of user functions is defined in a module, implemented as a Windows DLL or UNIX shared library. These modules are loaded automatically according to the module name. See the front end documentation for more details about creating user function modules in the front end.


The frontCall method

Purpose:

The Interface built-in class provides a special method to perform front end calls.

Syntax:

ui.Interface.frontCall( module, function, parameter-list, returning-list )

Notes:

  1. module is a string defining the name of the module (DLL or shared lib) where the function is defined. When you specify "standard", it references built-in functions provided by default by the front end.
  2. function is a string defining the name of the function to be called.
  3. parameter-list is a list of input parameters.
  4. returning-list is a list of output parameters.

Usage:

Module and function names are case-sensitive.

Input and output parameters are provided as a variable list of parameters, with the square braces notation ([param1,param2,...]). Input parameters can be an expression supported by the language, while all output parameters must be variables only, to receive the returning values. An empty list is specified with [].

Errors:

If the function could not be executed properly, one of the following exceptions might occur:

Error number Description
-6331 The module specified could not be found.
-6332 The function specified could not be found.
-6333 The function call failed (fatal error in function).
-6334 A function call stack problem occurred (usually, wrong number of parameters provided).

Example:

01 MAIN
02   DEFINE data STRING
03   CALL ui.Interface.frontCall( "mymodule", "connect", ["client1",128], [] )
04   LET data = "Hello!"
05   CALL ui.Interface.frontCall( "mymodule", "send", [data, data.getLength()], [] )
06   CALL ui.Interface.frontCall( "mymodule", "receive", [], [data] )
07   DISPLAY data
08   CALL ui.Interface.frontCall( "mymodule", "disconnect", ["client1"], [] )
09 END MAIN

Standard built-in front end functions

The following table shows the standard build-in functions implemented in the front end. The module name is always "standard": 

Function Name Description
execute Executes a command on the workstation with or without waiting.
Parameters:
- The command to be executed.
- The wait option (1=wait, 0=do not wait).
Returns:
- The execution result (TRUE=success, FALSE=error).
feinfo Returns front end properties like the front end type, the workstation operating system type.
Parameters:
- The name of the property.
Returns:
- The value of the property.
Property name  Description
fename  The name of the front end.
ostype  The operating system type (UNIX, WINDOWS, MACOSX).
shellexec Opens a file on the workstation with the program associated to the file extension.
Parameters:
- The document file to be opened.
Returns:
- The execution result (TRUE=success, FALSE=error)
Warning!: Works only under Windows systems.
getenv Returns an environment variable set in the user session on the front end workstation.
Parameters:
- The name of the environment variable.
Returns:
- The value of the environment variable.
opendir Displays a file dialog window to get a directory path on the local file system.
Parameters:
- The default path.
- The caption to be displayed.
Returns:
- The name of the selected directory (or NULL if canceled).
openfile Displays a file dialog window to get a path to open a file on the local file system.
Parameters:
- The default path.
- The name to be displayed for the file type.
- The file types (as a blank separated list of extensions).
- The caption to be displayed.
Returns:
- The name of the selected file (or NULL if canceled).
savefile Displays a file dialog window to get a path to save a file on the local file system.
Parameters:
- The default path.
- The name to be displayed for the file type.
- The file types (as a blank separated list of extensions).
- The caption to be displayed.
Returns:
- The name of the selected file (or NULL if canceled).
cbclear Clears the content of the clipboard.
Parameters: none.
Returns:
- The execution result (TRUE=success, FALSE=error).
cbset Set the content of the clipboard.
Parameters:
- The text to be set.
Returns:
- The execution result (TRUE=success, FALSE=error).
cbget Gets the content of the clipboard.
Parameters: none.
Returns:
- The text in the clipboard.
cbadd Adds to the content of the clipboard.
Parameters:
- The text to be added.
Returns:
- The execution result (TRUE=success, FALSE=error).
cbpaste Pastes the content of the clipboard to the current field.
Parameters: none.
Returns:
- The execution result (TRUE=success, FALSE=error).
mdclose Unloads a DLL or shared library module.
Parameters:
- The name of the module.
Returns:
- 0 = success, -1 = module not found, -2 = cannot unload (busy).