XWindows unitXTimers unitXApplets.pas unit

    This unit contains definition of XApplet class and declaration of global variable Applet, which is intended to replace Delphi VCL Application:TApplication variable. XApplet class is derived from XWindow because it defines application button window.
   Note: inherited properties and methods, which has no sense for XApplet or not recommeded to use, marked with gray color. Also, such protected ones skipped here at all (because XApplet class can not be ancestor for other classes).

XApplet <= XWindow <= XVisual <= XClass <= TObject

XApplet properties:

Properties, inherited from XWindow:

Properties inherited from XVisual:

Properties inherited from XClass:

 


XApplet methods:

Methods, inherited from XWindow:

Methods, inherited from XVisual:

Methods inherited from XClass:

 


Events of XApplet object:

Event, ihherited from XWindow:

 


Other definitions of XApplets.pas unit:

 


Tasks.

    You must not to descend objects from XApplet, because a single variable Applet : XApplet is alredy defined in XApplets.pas unit. Just call constructor for it and call its method Run to start executing of applet.


   I found that here is the best place to show as an example
how to start XCL project
which does not use VCL forms, controls and components and is extremely small.

   1st way (complex). First, create new project in Delphi. Then, open Project Manager and remove Unit1 from list. Open Project|Options and in tab sheet Directories/... clear search directories list. Save Your project (I prefer to create subdirectory for it in folder, where XCL units are stored). In menu View|Project source (in D3) or Project|View source (in D4) open .dpr-file which represents Delphi project but actually is pascal program. Delete reference to Forms in uses clause, and add references to Windows and Messages units. Also delete all lines between begin and end statements and save project. If You uncheck now options 'Local symbols', 'Refernce info' (in tabsheet Compiler of Project|Options dialog) and build this project, You obtain very small application (about 17Kbytes). But it can not do nothing and if You want to add some code to it, You will need to create and show at least main window and some controls. And application becomes big again. If not XCL...
   Add now to uses clause of dpr-file references to XForms, XApplets, XClasses, XWindows, XStrUtils, XVisuals, XGraphics (theses seven are minimal set of modules You need) and other XCL and your units, which You want been referenced here. References to seven above minimal necessary units have to be qualified with in operator (I suppose here that your XCL project is located in subfolder of directory with XCL units):

uses Windows, Messages,
     XForms in '..\XForms.pas',
     XApplets in '..\XApplets.pas',
     XClasses in '..\XClasses.pas',
     XWindows in '..\XWindows.pas',
     XStrUtils in '..\XStrUtils.pas',
     XVisuals in '..\XVisuals.pas',
     XGraphics in '..\XGraphics.pas',
     MyMain;

   2nd way. If You do so as above, You need to add here refernces to other XCL units if You receive message 'can not found some_name.pas unit'. If You do not like it, just open Project|Options dialog and in tab 'Directories/..' add directory where XCL units are located (if You followed to my advice to locate project in subfolder of such directory, it is sufficient to write '..' (without commas) as a single path). In that case it is possible to list only XForms and XApplets units in uses clause of XCL project file, and without full qualifying of names as above.
   Then, write code similar following between begin and end statements (pay attantion that existing global variable Applet is referred here and You must not create other instances of XApplet class in your project):

Applet := XApplet.Create;
MyForm := XMyForm.Create(Applet);
Applet.Run;

    Second line here is calling your XMyForm class constructor, which declaration (I suppose) is located in your unit (e.g. mymain.pas) and such unit is listed in uses clause of this dpr-file (didn't forget to do it?). Another, You may create instance of XForm without deriving new one from it and just write:

Applet := XApplet.Create;
XForm.Create;
Applet.Run;

    As You see You even do not need to store created form in variable (because it is the first window, so it can be referenced as Applet.MainWindow). Try now to build this project and run it. You will see simple applet with one nonamed window, and even its button on system start bar has no caption. And if You made all right, its size must be about 28Kbytes.

3rd way (easy). Open project Template.dpr and Save as YourName.dpr in directory where You wish (I recommend to use subdirectory of folder where XCL units are stored, and set in Project options/Directories/Search path '..'). Start changing it and compiling it.


goto XCL page

goto home page