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 built-in functions implemented by the front ends in the "standard" module. Note that most of these functions are supported by desktop front-ends (GDC/GJC) only.

Warning: Additional modules and functions are available for front-ends, but are specific to the front-end type. Please refer to the front-end documentation for more details.

Function Name Front-ends Description
execute GDC, GJC 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 GDC, GJC, GWC 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 GDC, GJC Opens a file on the workstation with the program associated to the file extension.
Parameters:
- The document file to be opened.
Windows Only!: - the action to perform, related to the way the file type is registred in Windows Registry (Optionnal).
Returns:
- The execution result (TRUE=success, FALSE=error)
Warning!: Under X11 Systems, this uses kde's kfmclient tool, which needs to be installed on your system.
getenv GDC, GJC 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 GDC, GJC 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 GDC, GJC 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 GDC, GJC 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 GDC, GJC Clears the content of the clipboard.
Parameters: none.
Returns:
- The execution result (TRUE=success, FALSE=error).
cbset GDC, GJC Set the content of the clipboard.
Parameters:
- The text to be set.
Returns:
- The execution result (TRUE=success, FALSE=error).
cbget GDC, GJC Gets the content of the clipboard.
Parameters: none.
Returns:
- The text in the clipboard.
cbadd GDC, GJC Adds to the content of the clipboard.
Parameters:
- The text to be added.
Returns:
- The execution result (TRUE=success, FALSE=error).
cbpaste GDC, GJC Pastes the content of the clipboard to the current field.
Parameters: none.
Returns:
- The execution result (TRUE=success, FALSE=error).
mdclose GDC, GJC Unloads a DLL or shared library module.
Parameters:
- The name of the module.
Returns:
- 0 = success, -1 = module not found, -2 = cannot unload (busy).