Icon Classes

The Object Pascal language used by Elevate Web Builder is an object-oriented language that allows one to define classes that represent objects with their own data (variables and properties) and behaviors (functions and procedures).

Information Functions and procedures that are declared in a class are referred to as "methods". For the rest of this topic the term "methods" will be used to represent the functions and procedures declared in a class.

Classes are useful because they offer:
  • Encapsulation: Both data and behaviors are combined into one logical construct, and data that is internal to the class can be hidden so that only the class itself can access it. Also, properties can be defined that offer a specific interface to the data contained in a class, thus avoiding exposing internal data directly or requiring that all access to the data be done through methods.


  • Inheritance: Classes can descend from other classes and inherit the functionality of the ancestor class in the process, thus forming what is termed a "class hierarchy". There is no limit to the depth of such a hierarchy. In addition, the functionality of ancestor class(es) can be overridden in descendant classes in order to supplement or completely replace the base functionality.
Information Elevate Web Builder only supports single inheritance. This means that each class can only descend from one class, and there is only one single path between an ancestor class and a descendant class.

Class Declarations
Before a class can be used, it must be declared in the type section of a unit. A class declaration consists of the following:

<Class Name> = class [(<Ancestor Class Name>)]
   [<Private Class Members>]
   [<Protected Class Members>]
   [<Public Class Members>]
   [<Published Class Members>]
   end;

Information To keep with the traditional coding style of Object Pascal, all <Class Name> specifications should normally begin with a "T" prefix (stands for "Type").

If you do not specify an <Ancestor Class Name>, then the class will inherit from the system-defined TObject class (see below).

The private, protected, public, and published designations specify the scope of the class members. The scope of the class members determine their visibility to descendant class declarations, as well as any code that uses an instance of the class. In addition, the published scope determines which properties are visible at design-time in the IDE and which properties are streamable using the persistence functionality in the component library. Please see the Scope topic for more information on the various class member scope designations.

TObject
The TObject class is the base ancestor class for all classes. The declaration for the TObject class is as follows:

TObject = class
   public
      constructor Create; virtual;
      destructor Destroy; virtual;
      class procedure Free;
      class function ClassType: TClass;
      class function ClassName: String;
      class function ClassParent: TClass;
   end;

The Create method is the class constructor and the Destroy method is the class destructor. The constructor method is called when a class instance is created, and the destructor method is called when a class instance is freed. Please see the Methods topic for more information on constructors and destructors.

The ClassType method is a class method that returns the class type as a result. This method is useful in situations where you need to interrogate the class type of either a class or a class instance.

The ClassName method is a class method that returns the class name as a result. The client component library uses this method a lot in order to link control classes to specific control interfaces.

The ClassParent method is a class method that returns the parent class type as a result. This information can be used to determine the ancestry of a class.

Information The above Class* methods are class methods, which means that they are static methods that can operate on both classes and class instances. Please see the Methods topic for more information on class methods.

Class Members
The class members in a class declaration are the various variables, properties, methods, and events that define the data and behaviors of the class. Class members can be declared in any order within a specific scope in a class declaration.

Please use the following links to get more information on each type of class member:

Variables
Methods
Properties
Events
Image