XVisuals unitXClasses.pas unit

    This unit contains definition of the base class for all XCL objects tree - XClass. It is a descender of TObject and only adds ability to become a parent and to have childs of XClass type. Also it is using simple object ZList which is intended to replace Delphi TList. ZList does not support of sorting, swapping of elements and it is compiled to smaller code. ZList class also is defined in XClasses.pas unit.
    All the other XCL classes are descending from XClass, so all those inherit properties ChildCount and Children[ Idx ] and methods AddChild and DeleteChild (but these last two usually not needed because the constructor of XClass is overridden and have AParent : XClass parameter).
    In contrast to VCL, where base class for all objects is TPersistent, XCL objects do not provide ability of reading its original state from form definition, stored in executable. This allow not to link stream support modules, input/output routines needed to read data from executable and recognize it and do not store form definition resources blocks in executable. As a result, application stays dramatically small. (So I decided to call applications, created with XCL, as APPLETS - not applications).
    Disadvantage of this is only non-visual programming, which is inconvenient for programmers because it is necessary now to place controls on forms only at run time. Programming in XCL, at design time developer can now work only with pascal code. No ObjectInspector, no double click on event to create event handler, no components palette and so on. But all these is generously repaid by extremely small size of the final application, and You do not ever need to distribute bpl- or dpl-files to deploy it!

XClass <= TObject

XClass properties:

XClass methods:

 


ZList = class( TObject );

ZList properties:

ZList methods:

 


Other definitions of XClasses.pas unit:

   Also type XMethod declared here. It is very similar to TMethod, defined in Classes.pas belonging to VCL, and can be used for the same purposes (to access variables of type 'procedure of object').

    Also class XChild derived from XClass is defined here. It overrides AddChild method to prevent adding children. Its purpose is to be ancestor of classes, which can be children for XClass descending parents, but avoid to be parents itself (e.g., XTimer ).


Tasks.

    Usually You have not to create instances and descend new classes directly from XClass if You want to create visual elements (forms, controls). To create new control, use XCustomControl or XMfcControl as a base. And to create new type of form use XForm as an ancestor. Type XClass is taking place at the root of XCL hierarchy and You only have to know its properties and methods which are inheriting in its descenders.
    You can derive new class from XClass and its descenders (vs TObject) if You want to destroy it automatically when its parent (descender of XClass too) is destroyed. Nothing else. And this is similar for TComponent descenders in Delphi VCL.

    Type ZList is useful and necessary in most programming tasks. And You may use it as an ancestor of more complex lists (e.g. to add sorting ability to these).

goto XCL page

goto home page