Pzl-Component in 10 steps

From wiki.visual-prolog.com

Revision as of 23:07, 26 November 2009 by Victor Yukhtenko (talk | contribs) (New page: '''Basic Definitions of the Pzl-Technology''' Classes and packages, wrapping these classes, which fit the special agreement, are called the Pzl-components. Pzl-components are placed in p...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Basic Definitions of the Pzl-Technology

Classes and packages, wrapping these classes, which fit the special agreement, are called the Pzl-components.

Pzl-components are 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.

PzlStudio DemoRun Initialized.png

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:

PzlStudio OptionsDLG.png

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.

PzlStudio DemoRun ContainerCreate.png

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.

PzlStudio DemoRun ContainerAtIDE.png

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.

PzlStudio DemoRun ComponentCreate.png

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.

PzlStudio DemoRun AddComponent.png

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.

PzlStudio Demo ComponentAddedProject.png

Build the project (Ctrl-Shift-B). Accept the adding of the new packages to the project by pressing Add All.

PzlStudio DemoRun ContainerAddGuiDialog.png

Now you can see all files of the package MyHelloWorld.pack in the project window.

PzlStudio Demo ProjectCompiled.png

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>

PzlStudio DemoRun RegisteringSelection.png

Select the pzl-component "MyHelloWorld". Press the button Register Selected. The component is registered!

PzlStudio DemoRun RegisteringRegistered.png

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.

PzlStudio DemoRun IDESourceImplementation.png

Write to the predicate's 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).

PzlStudio DemoRun IDESourceUpdated.png

Step 9. Compile the pzl-container

Run project building (Ctrl-Shift-B).

Accept proposals of the IDE by pressing Add All

PzlStudio DemoRun AddVPIToProject.png

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:

PzlStudio DemoRun InvokeRun.png

Press Run and get

PzlStudio DemoRun RunResult.png

References