Pzl-Component in 10 steps
Basic Definitions of the Pzl-Technology
Classes and packages, wrapping these classes, which fit the special agreement, are called the Pzl-components.
Pzl-components placed in pzl-containers. Pzl-container may contain an unlimited amount of pzl-components.
The interaction between the usual Visual Prolog classes and pzl-components, and the interaction between pzl-components are handled by the pzl-system.
The main part of the application, which includes the pzl-system core, is named PzlPort.
The DLL, which is built in accordance with the pzl-technology agreements, is named the DLL-container.
The dll-container and the pzlPort are pzl-containers.
Step 1. The first run of the Elementary PzlStudio
If you have no PzlStudio PzlStudio in the menu Start/... of you computer, then you should find the directory SpbSolutions/Bin and run the application PzlStudioElementary.exe.
Please check the status of your settings and modify them if there is such a need. To do so you should call the form to set the Basic Options using the menu item Tools/Options:
Press Close to close the form.
Step 2. Create the pzl-container MyHelloWorld
Using the menu entry File/New.../Container in the Elementary PzlStudio invoke the form and set:
- the name of the directory of the pzl-container MyDemoContainer.
- the name of the container MyDemoContainer.
Press Create. The container is created!
Press Close to close the form.
Step 3. Compile the pzl-container
Open the IDE of the Visual Prolog system.
Open the project MyDemoContainer.prj6.
Build the project (Ctrl-Shift-B).
Save the project (Ctrl-S).
Шаг 4. Crate the pzl-component
Using the menu item '’'File/New.../Component in the Elementary PzlStudio invoke the form and set:
- The directory name MyHelloWorld
- The name of the pzl-component MyHelloWorld.
There is no need to edit the rest parameters.
Press Create. The pzl-component is created!
Press Close to close the form.
Step 5. Add the pzl-component to the pzl-container
Invoke the form using the menu item Tools/Add.../Component To Container and set there:
- The name of the pzl-container ... /MyDemoContainer.prj6
- The package of the pzl-component ... /MyHelloWorld.pack.
Press Add As Original. The pzl-component placed to the pzl-container!
Press Close to close the form.
Step 7. Compile the pzl-container
Come back to IDE. It is supposed the project MyDemoContainer.prj6 is still opened.
Build the project (Ctrl-Shift-B). Accept the adding of the new packages to the project by pressing Add All.
Now you can see all files of the package MyHelloWorld.pack in the project window.
Save the project (Ctrl-S).
Step 7. Register the pzl-component
Invoke the registration form using the menu entry Tools/Register Components and set there:
- The name of the pzl-container file MyDemoContainer.PZL (...) – you can find if in the target directory of the project
- View The Content of <Container> at Target <Current User>
Select the pzl-component "MyHelloWorld". Press the button Register Selected. The component is registered!
Press ‘’’Close’’’ to close the form.
Шаг 8. Write the code in the class MyHelloWorld
Come back to the IDE of the Visual Prolog system.
Make the DoubleClick on the file MyHelloWorld.pro.
Write to the predicates spbRun(...) body the call
clauses spbRun(""):- !, MSG="My Hello to World from MyDemoContainer!", write(MSG), vpiCommonDialogs::note(MSG). spbRun(UserText):- MSG=string::format("My Hello to World from MyDemoContainer!\nEntered:%\n",UserText), write(MSG), vpiCommonDialogs::note(MSG).
Step 9. Compile the pzl-container
Run project building (Ctrl-Shift-B).
Accept proposals of the IDE by pressing Add All
Now component makes something valuable!
Step 10. Run it!
In the PzlStudio:
- Using the menu entry View/PzlStatus invoke the pzl-system status form
- Using the menu entry Tools/Run Component invoke the component invocation form, find there the component MyHelloWorld, and write the text to the ‘’’Parameter’’’ field:
Press Run and get