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. This last does not support of sorting, swapping of elements and it is compiled to smaller code. ZList object also is defined in XClasses.pas unit.
    All the other objects 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. This allow not to link stream support modules, input/output routines needed to read data from executable and recognize it and do not create form definition 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 inconvenience 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 this is generously repaid by extremely small size of end application, and You do not ever need to distribute bpl- or dpl-files to do it!

XClass = class( TObject );

XClass properties:

XClass methods:

 


ZList = class( TObject );

ZList properties:

ZList methods:

 


Other definitions of XClasses.pas unit:

    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 descend objects directly from XClass if You want to create visual elements (forms, controls). To create new control, use XControl 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 know its properties and methods which are inheriting of its descenders.
    You can derive new objects from XClass if You want it to destroy automatically when its parent (descender of XClass) 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 it).

goto XCL page

goto home page