Icon Defines

Elevate Web Builder supports basic compiler define functionality. Compiler defines are symbols used to conditionally include or exclude code in the compilation process, and can be tested at compile-time to make such a determination. Compiler defines are taken into account during the parsing phase of the compilation process.

Defining Symbols
You can create a compiler define using the following syntax:

{$DEFINE <Symbol>}

Once a symbol has been defined, it will be effective for the remaining code in the current unit. Defining a symbol that is already defined does nothing.

Warning Compiler defines are not nested. If a symbol is re-defined (it was already defined), and then un-defined, the result will be that the symbol will be undefined.

You can use the Project Options in the IDE to create application-wide compiler defines. Please see the Modifying Project Options topic for more information.

Un-Defining Symbols
You can remove a compiler define using the following syntax:

{$UNDEF <Symbol>}

Testing for Defined Symbols
To test whether a symbol has been defined, you can use the following syntax:

{$IFDEF <Symbol>}
// Include this code if the symbol is defined
[{$ELSE}]
// Include this code if the symbol is not defined (optional)
{$ENDIF}

To test whether a symbol has not been defined, you can use the following syntax:

{$IFNDEF <Symbol>}
// Include this code if the symbol is not defined
[{$ELSE}]
// Include this code if the symbol is defined (optional)
{$ENDIF}

An IFDEF or IFNDEF test must always be terminated with an ENDIF. The ELSE conditional branch is optional.

Built-In Defines
Elevate Web Builder includes several built-in compiler defines that control various aspects of how the component library and applications are built:

DefineDescription
DESIGNIndicates that the code is being compiled for execution in the IDE
BROWSERIndicates that the code is being compiled for execution in a client application
RUNTIMEIndicates that the code is being compiled for execution in a server application
CLIENTIndicates that the code is being compiled for client usage
SERVERIndicates that the code is being compiled for server usage
VERNNNIndicates the major/minor version of the Elevate Web Builder compiler, where NNN is the major/minor version number (without the period between the major and minor versions)
Information For a given major verison, a compiler define is also created automatically for any minor versions that belong to the same major version, but are prior to the current minor version. For example, if the current major/minor version is 3.02, then the following compiler defines will be present: VER300, VER301, and VER302

Example
The following is code from the standard component library that tests for the special DESIGN symbol to determine whether to use the WebDesign (IDE run-time) or the WebDOM (browser run-time) unit:

{$IFDEF BROWSER}
uses WebDOM;
{$ENDIF}
{$IFDEF SERVER}
uses WebSrvr;
{$ENDIF}
Image