Built-in macros: $ApplicationClass

The $ApplicationClass macro is replaced by the value specified in the ApplicationClass attribute of the profile the code is currently compiled for.

Content

unit‑name::class‑name

Discussion

This macro contains the full name of the class representing the GUI application main component. The application component serves as the root of your entire application - accordingly all other GUI components will be enclosed (directly or indirectly) inside the application component. As such the application component is also called the 'root object'.

The full name is composed of two identifiers: the name of the unit containing the application class definition and the name of the class itself, both separated by :: (double colon). Following is an example of a full name identifying an application class:

ProjectUnit::Application

This macro can be useful when your project contains several implementations of the application class and there are other components in your project depending on the functionality implemented in the application classes. In such case you use the $ApplicationClass macro to perform a correct object cast operation before accessing the mentioned functionality of the application root object:

var $ApplicationClass rootObject = ($ApplicationClass)GetRoot(); if ( rootObject != null ) rootObject.PerformSomeOperation();

You can also use the macro inside a string literal to format e.g. a trace debug message:

trace "The name of the current application class is $ApplicationClass ...";