Pzl-Component in 10 steps: различия между версиями

Материал из wikiru.visual-prolog.com

м (Новая: '''Основные понятия Pzl-Технологии''' Классы, и пакеты, в которые они помещаются, удовлетворяющие принят...)
 
 
(не показано 5 промежуточных версий этого же участника)
Строка 1: Строка 1:
'''Основные понятия Pzl-Технологии'''
'''Basic Definitions of the Pzl-Technology'''


Классы, и пакеты, в которые они помещаются, удовлетворяющие принятым соглашениям, называются Pzl-компонентами.
Classes and packages, wrapping these classes, which fit the special agreement, are called the Pzl-components.


Pzl-Компоненты помещаются в Pzl-Контейнеры. Pzl-Контейнер может содержать неограниченное число Pzl-Компонент.
Pzl-components are placed in pzl-containers. Pzl-container may contain an unlimited amount of pzl-components.


Взамодействие обычных классов системы Visual Prolog и PZl-компонент, а также Pzl-компонент между собой, обеспечивается Pzl-Системой.
The interaction between the usual Visual Prolog classes and pzl-components, and the interaction between pzl-components are handled by the pzl-system.


Главное приложение пользователя, включающее ядро Pzl-Системы, называется Pzl-Порт (PzlPort).
The main part of the application, which includes the pzl-system core, is named PzlPort.


DLL, построенная в соответствии с принятыми соглашениями, называется DLL-контейнером.
The DLL, which is built in accordance with the pzl-technology agreements, is named the DLL-container.


Dll-Контейнер и Pzl-Порт являются Pzl-Контейнерами.
The dll-container and the pzlPort are pzl-containers.


=Шаг 1. Первый запуск Elementary PzlStudio=
=Step 1. The first run of the Elementary PzlStudio=
Если у Вас нет PzlStudio в меню '''Start/...''' компьютера, то найдите директорию '''SpbSolutions/Bin''' и запустите приложение PzlStudioElementary.exe.
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.
 
Вы получаете


[[Image:PzlStudio DemoRun Initialized.png]]
[[Image:PzlStudio DemoRun Initialized.png]]


Проверьте состояние Ваших установок и при необходимости откорректируйте их.
Please check the status of your settings and modify them if there is such a need.
Для этого вызовите через '''Tools/Options''' форму установки общих свойств:
To do so you should call the form to set the Basic Options using the menu item '''Tools/Options''':


[[Image:PzlStudio OptionsDLG.png]]
[[Image:PzlStudio OptionsDLG.png]]


Нажимаем '''Close''', закрываем форму.
Press '''Close''' to close the form.


=Шаг 2. Создаем контейнер MyHelloWorld=
=Step 2. Create the pzl-container MyHelloWorld=
В Elementary PzlStudio через меню '''File/New.../Container''' вызываем форму и устанавливаем:
Using the menu entry '''File/New.../Container''' in the Elementary PzlStudio invoke the form and set:
*имя директории контейнера ''MyDemoContainer''.
*the name of the directory of the pzl-container ''MyDemoContainer''.
*имя контейнера ''MyDemoContainer''.
*the name of the container ''MyDemoContainer''.


[[Image:PzlStudio DemoRun ContainerCreate.png]]
[[Image:PzlStudio DemoRun ContainerCreate.png]]


Нажимаем '''Create'''. Контейнер создан!
Press '''Create'''. The container is created!


Нажимаем '''Close''', закрываем форму.
Press '''Close''' to close the form.


=Шаг 3. Компилируем контейнер=
=Step 3. Compile the pzl-container=
Открываем IDE системы программирования Visual Prolog.
Open the IDE of the Visual Prolog system.


Открываем Проект ''MyDemoContainer.prj6''.
Open the project ''MyDemoContainer.prj6''.


[[Image:PzlStudio DemoRun ContainerAtIDE.png]]
[[Image:PzlStudio DemoRun ContainerAtIDE.png]]


Строим проект (Ctrl-Shift-B).
Build the project (Ctrl-Shift-B).


Сохраняем проект (Ctrl-S).
Save the project (Ctrl-S).


=Шаг 4. Создаем компоненту=
=Шаг 4. Crate the pzl-component =
В Elementary PzlStudio через меню '''File/New.../Component''' вызываем форму и устанавливаем:
Using the menu item '''File/New.../Component''' in the Elementary PzlStudio invoke the form and set:
*Имя директории компоненты ''MyHelloWorld''
*The directory name ''MyHelloWorld''
*Имя компоненты ''MyHelloWorld''.
*The name of the pzl-component ''MyHelloWorld''.


Остальные параметры не редактируем, они нам подходят.
There is no need to edit the rest parameters.


[[Image:PzlStudio DemoRun ComponentCreate.png]]
[[Image:PzlStudio DemoRun ComponentCreate.png]]


Нажимаем '''Create'''. Компонента создана!
Press '''Create'''. The pzl-component is created!


Нажимаем '''Close''', закрываем форму.
Press '''Close''' to close the form.


=Шаг 5. Добавляем компоненту в контейнер=
=Step 5. Add the pzl-component to the pzl-container =
Через меню '''Tools/Add.../Component To Container''' вызываем форму и устанавливаем:
Invoke the form using the menu item '''Tools/Add.../Component To Container''' and set there:
*Имя проекта контейнера ''... /MyDemoContainer.prj6''
*The name of the pzl-container ''... /MyDemoContainer.prj6''
*Пакет компоненты ''... /MyHelloWorld.pack''.
*The package of the pzl-component ''... /MyHelloWorld.pack''.


[[Image:PzlStudio DemoRun AddComponent.png]]
[[Image:PzlStudio DemoRun AddComponent.png]]


Нажимаем '''Add As Original'''. Компонента в контейнере!
Press '''Add As Original'''. The pzl-component placed to the pzl-container!


Нажимаем '''Close''', закрываем форму.
Press '''Close''' to close the form.
=Шаг 6. Компилируем контейнер=
=Step 7. Compile the pzl-container =
Возвращаемся к IDE, к тому же проекту MyDemoContainer.prj6.
Come back to IDE. It is supposed the project MyDemoContainer.prj6 is still opened.


[[Image:PzlStudio Demo ComponentAddedProject.png]]
[[Image:PzlStudio Demo ComponentAddedProject.png]]


Запускаем построение проекта (Ctrl-Shift-B). Соглашаемся '''Add All''' на предложение IDE по добавлению пакетов в проект.
Build the project (Ctrl-Shift-B). Accept the adding of the new packages to the project by pressing '''Add All'''.


[[Image:PzlStudio DemoRun ContainerAddGuiDialog.png]]
[[Image:PzlStudio DemoRun ContainerAddGuiDialog.png]]


Теперь в проекте видны все файлы пакета MyHelloWorld.pack.
Now you can see all files of the package MyHelloWorld.pack in the project window.


[[Image:PzlStudio Demo ProjectCompiled.png]]
[[Image:PzlStudio Demo ProjectCompiled.png]]


Сохраняем проект (Ctrl-S).
Save the project (Ctrl-S).


=Шаг 7. Регистрируем компоненту=
=Step 7. Register the pzl-component =
В E'ementary PzlStudio через меню '''Tools/Register Components''' вызываем форму и устанавливаем:
Invoke the registration form using the menu entry '''Tools/Register Components''' and set there:
*Имя PZL-файла контейнера ''MyDemoContainer.PZL (...)'' - находим в целевой директории проекта
*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>'''
*View The Content of '''<Container>''' at Target '''<Current User>'''


[[Image:PzlStudio DemoRun RegisteringSelection.png]]
[[Image:PzlStudio DemoRun RegisteringSelection.png]]


Отмечаем компоненту "MyHelloWorld".
Select the pzl-component "MyHelloWorld".
Нажимаем кнопку '''Register Selected'''. Компонента зарегистрирована!
Press the button '''Register Selected'''. The component is registered!


[[Image:PzlStudio DemoRun RegisteringRegistered.png]]
[[Image:PzlStudio DemoRun RegisteringRegistered.png]]


Нажимаем '''Close''', закрываем форму.
Press ‘’’Close’’’ to close the form.


=Шаг 8. Пишем программу в классе MyHelloWorld=
=Шаг 8. Write the code in the class MyHelloWorld=


Возвращаемся к IDE системы Visual Prolog.
Come back to the IDE of the Visual Prolog system.


Делаем двойной щелчок на файле MyHelloWorld.pro.
Make the DoubleClick on the file MyHelloWorld.pro.


[[Image:PzlStudio DemoRun IDESourceImplementation.png]]
[[Image:PzlStudio DemoRun IDESourceImplementation.png]]


Помещаем в тело предиката spbRun(...) вызов
Write to the predicate's spbRun(...) body the call
<vip>
<vip>
clauses
clauses
Строка 125: Строка 123:
[[Image:PzlStudio DemoRun IDESourceUpdated.png]]
[[Image:PzlStudio DemoRun IDESourceUpdated.png]]


=Шаг 9. Опять компилируем контейнер=
=Step 9. Compile the pzl-container =
Запускаем построение проекта (Ctrl-Shift-B).
Run project building (Ctrl-Shift-B).


Соглашаемся с предложением IDE нажатием '''Add All'''
Accept proposals of the IDE by pressing '''Add All'''


[[Image:PzlStudio DemoRun AddVPIToProject.png]]
[[Image:PzlStudio DemoRun AddVPIToProject.png]]


Компонента теперь делает нечто осмысленное!
Now component makes something valuable!


=Шаг 10. Запускаем!=
=Step 10. Run it!=
В Elementary PzlStudio:
In the PzlStudio:
*Через меню '''View/PzlStatus''' вызываем форму состояния Pzl-Системы
*Using the menu entry '''View/PzlStatus''' invoke the pzl-system status form
*Через меню '''Tools/Run Component''' вызываем форму запуска компонент, находим нашу компоненту ''MyHelloWorld'', пишем сообщение в поле параметра:
*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:


[[Image:PzlStudio DemoRun InvokeRun.png]]
[[Image:PzlStudio DemoRun InvokeRun.png]]


Нажимаем '''Run''', получаем
Press '''Run''' and get


[[Image:PzlStudio DemoRun RunResult.png]]
[[Image:PzlStudio DemoRun RunResult.png]]

Текущая версия на 11:16, 7 февраля 2008

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