Creation of the Pzl-Component
Written by Victor Yukhtenko. Email: firstname.lastname@example.org
Pzl-component is the package of the Visual Prolog programming system. The IDE of the Visual Prolog system can create the class and the package within the currently opened project. The Elementary PzlStudio cannot deal with the Visual Prolog projects fully. The Elementary Studio performs the elementary operation, which creates the pzl-component independent of the project. The newly created pzl-component may be later placed to any pzl-container.
To create the pzl-component it needs to fill the form, which contains the properties of the pzl-component such as the component identifier, component alias, the name of the base class and the name of the interface etc..
When the form is filled, you press the button and you get the pzl-component, which may be now embedded to any pzl-container (executable application or the DLL).
Invoking the Operation
The form to create the pzl-component is invoked via the menu item File/New.../Component.
The list of properties is shown below
- Components Base Directory
- Sub-Directory – the path to the sub-directory for the component package.
- Component Name – the name of the package file
- Class Name – the name of the component base class
- Interface Name - the name of the component base interface
- Component Alias
- Component ID
- RunAble – Boolean flag
- UI Strategy
The editing of the option is performed in the right side of the table. The Editing supposed to be done by the explicit editing or it may be done by the pressing the button on the right side of the active field. Double clicking makes the same as pressing the button.
The operation is performed by clicking the button Create.
The button may be inactive if there is not enough data entered.
After the operation completion you may create any other pzl-component.
The button Close closes the form.
Performing the Operation
While the performing the operation the Message Window gets the report regarding the changes made in the project.
The newly created the Pzl-component may be embedded now to the pzl-container.
Properties of the Pzl-Component
Components Base Directory
This is the name of the directory, which was set in the Basic Options. If you have no reasons to change the directories organization, then you may leave this property with no changes.
You may change the Components Base Directory. Just make a double click or press the button at the right side. This will invoke the file dialog to choose the name of the directory. If you set the name of the directory, which doesn’t exist, then Elementary PzlStudio will create it, if possible
If you have changed the Components Base Directory compare to what was set in the basic options, then when the form will be closed you will get the question whether you wish to make changes in the Basic Options.
If you agree, then the new value will be used each time, when it participates in any operation.
The Component Sub-Directory is exactly the directory, where all files of the package of the pzl-component will be generated.
The Sub-Directory must be considered as the path (say Dir1/Dir2/Dir3 or just Dir1), which together with the base directory of the components gives the final path to the directory, where all files of the component will be placed.
The property Sub-Directory is mandatory. It may not be empty.
If the final directory does not exist, then it will be created with no announcement.
If it is impossible to create the final directory, then the error dialog appeared with the error message.
Please notice: the name of the final directory of the pzl-component and the name of the package may differ. It has some difference from the rule used in the IDE of the Visual Prolog system. In the Visual Prolog, the name of the package defines also the name of the directory. Initially they proposed equal.
The name of the component defines the name of the set of files
- <Component Name>.pack,
- <Component Name>.ph,
- <Component Name>.cl,
- <Component Name>.i,
- <Component Name>.pro
The name of the Interface defines the base interface of the component. The base interface is the interface, which provides the class by the feature to create objects.
interface iMyInterface supports pzlComponent ...
Base Interface contains also all needed constants.
The name of the base interface of the pzl-component may not be the same as the name of the class. If this demand is not maintained, then the error message appears.
The name of the base interface may not be empty.
The class name defines the base class of the component, i.e. the class, which will be used to create the instances of the component.
class myComponent : iMyComponent open core ...
The name of the base class of the pzl-component may not be the same as the name of the interface. If this demand is not maintained, then the error message appears.
The name of the class may not be empty.
The component Alias may be any (not empty, no spaces) sequence of chars and serves to identify the type of the component like "TextEditor".
The component identifier may have one of the representations in the “New Component” form:
- any sequence (not empty, no spaces) of characters
- any sequence of chars, which corresponds to the UID.
The first representation can be created by the typing in the editable field
The second representation may be generated automatically by the pressing the button at the right side of the field.
The component property Runable defines the possibility to run the component independently.
It may have one of two values in the form: Yes and No. If “Yes” has been chosen, then the component will support the interface SpbRun
interface iMyInterface supports pzlComponent supports spbRun ...
The appropriate clause will be created in the file <ComponentName >.pro. The User must define the real code for that clause:
The property UI Strategy defines the style of the user interface. It corresponds to the types predefined by Visual Prolog system. Here in the form the UI strategy must be chosen from the list:
- VPI – traditional graphic engine
- GUI – object oriented graphic engine
- Consol – no user interface
Attributes from Basic Options
The last three positions in the form