Creation of the Pzl-Component: различия между версиями

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

м
м
Строка 7: Строка 7:
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).
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 =
Форма для создания pzl-Компоненты вызывается через меню '''''File/New.../Component'''''.  
The form to create the pzl-component is invoked via the menu item '''''File/New.../Component'''''.  


[[Изображение:PzlStudio_CreateNewComponent.png]]
[[Image:PzlStudio_CreateNewComponent.png]]


Перечень свойств в вызванной форме включает
The list of properties is shown below
*[[#Базовая Директория Компонент|Components Base Directory]] - Базовая директория Ваших Компонент
*[[#Components Base Directory|Components Base Directory]]
*[[#Директория pzl-Копоненты|Sub-Directory]] - Маршрут к поддиректории, в которой будет создан пакет компоненты.
*[[#Sub-Directory|Sub-Directory]] – the path to the sub-directory for the component package.
*[[#Имя Компоненты|Component Name]] - Имя создаваемой Компоненты (это будет имя пакета .pack)
*[[# Component Name|Component Name]] – the name of the package file
*[[#Имя Класса|Class Name]] - Имя '''Класса''' Компоненты
*[[# Class Name|Class Name]] – the name of the component base class
*[[#Имя Интерфейса|Interface Name]] - Имя '''Интерфейса''' Компоненты
*[[# Interface Name|Interface Name]] - the name of the component base interface
*[[#Условное имя компоненты|Component Alias]] - '''Условное имя''' Компоненты
*[[#Component Alias|Component Alias]]
*[[#Идентификатор компоненты|Component ID]] - '''Идентификатор''' Компоненты
*[[# Component ID|Component ID]]
*[[#Автономная Запускаемость|RunAble]] - Автономная Запускаемость
*[[# RunAble|RunAble]] – Boolean flag
*[[#Пользовательский интерфейс|UI Strategy]] - Пользовательский интерфейс
*[[# UI Strategy|UI Strategy]]
*[[#Атрибуты из базовых свойств|Company]] - имя компании
*[[#Attributes from Basic Options|Company]]
*[[#Атрибуты из базовых свойств|Author]] - имя автора
*[[# Attributes from Basic Options|Author]]
*[[#Атрибуты из базовых свойств|Copyright]] - авторские права
*[[# Attributes from Basic Options|Copyright]]


Редактирование значений свойств производится в правой части таблицы либо непосредственным редактированием (если допускается), либо вызовом следующего уровня редактирования нажатием на кнопку справа в активной строке. Двойной щелчек на поле редактирования равносилен нажатию на кнопу справа.
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.


Операция выполняется по нажатию на кнопку '''Create (Создать)'''.
The operation is performed by clicking the button '''Create'''.


Кнопка может быть неактивной, если введенных данных недостаточно для выполнения операции.  
The button may be inactive if there is not enough data entered.


После выполнения операции форма остается активной и Вы можете продолжить создание pzl-Компонент.
After the operation completion you may create any other pzl-component.


Кнопка '''Close (Закрыть)''' закрывает форму.
The button '''Close''' closes the form.


=Выполнение операции=
=Performing the Operation =


При успешном выполнении операции в окно сообщений среды Elementary PzlStudio выводится отчет о создании компоненты.
While the performing the operation the Message Window gets the report regarding the changes made in the project.


[[Изображение:PzlStudio CreatedNewComponentReport.png]]
[[Image:PzlStudio CreatedNewComponentReport.png]]


Созданную таким образом Pzl-Компоненту можно теперь включать в контейнеры.
The newly created the Pzl-component may be embedded now to the pzl-container.


=Параметры для создания Pzl-Компоненты=
=Properties of the Pzl-Component =


==Базовая Директория Компонент==
== Components Base Directory ==
Собственно, это имя директории, установленной в [[Установка Базовых Свойств#User PzlComponent Location|Базовых Свойствах]]. Если в Ваших намерениях по организации директорий ничего не изменилось, можно ничего здесь не менять.


This is the name of the directory, which was set in the [[Setting Basic Options#User PzlComponents|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


Двойной щелчек или нажатие на кнопку вызовут файловый диалог для выбора имени директории. Вы можете в Файловом диалоге установить и новое, не существующее имя директории. Elementary PzlStudio создаст ее, если это возможно.
If you have changed the Components Base Directory compare to what was set in the [[Setting Basic Options# User PzlComponents|basic options]], then when the form will be closed you will get the question whether you wish to make changes in the Basic Options.


Если Вы изменили имя базовой директории компонент относительно того, что установлено в [[Установка Базовых Свойств#User PzlComponents Location|Базовых Свойствах]], то при закрытии формы будет задан вопрос о внесении изменения в Базовые Свойства.
[[Image:PzlStudio_ChangeBaseComponentsDirectory.png]]


[[Изображение:PzlStudio_ChangeBaseComponentsDirectory.png]]
If you agree, then the new value will be used each time, when it participates in any operation.
== Sub-Directory ==


Если Вы согласитесь, то Вам будет теперь предлагаться в качестве значения по умолчанию это последнее имя базовой директории компонент.
The Component Sub-Directory is exactly the directory, where all files of the package of the pzl-component will be generated.


==Директория pzl-Компоненты==
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.
Директория Pzl-Компоненты - это именно та директория, в которую будут помещены все файлы пакета компоненты.


Директория Pzl-Компоненты следует рассматривать как маршрут (например, в форме Дир1/Дир2/Дир3 или просто Дир1), который в совокупности с Базовой директорией компонент даст окончательный маршрут к директории, где будут создаваться файлы компоненты.
The property ''' Sub-Directory ''' is mandatory. It may not be empty.


Поле '''Директория pzl-Компоенты''' не может быть пустым.
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.


Если '''Директория pzl-Компоненты''' по каким-либо причинам не может быть создана, то появится диалог с сообщением об ошибке.
'''''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.


== Component Name ==
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


'''''Обращаем внимание на то, что имя конечной  директории pzl-Компоненты и имя компоненты (пакета) могут различаться, хотя первоначально они будет предложены одинаковыми.'''''
==Interface Name==
 
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.
==Имя Компоненты==
Имя компоненты определяет имя набора файлов пакета
*<Имя Компоненты>.pack,
*<Имя Компоненты>.ph,
*<Имя Компоненты>.cl,
*<Имя Компоненты>.i,
*<Имя Компоненты>.pro
 
==Имя Интерфейса==
Имя интерфейса определяет базовый интерфейс компоненты, то есть интерфейс, который наделяет класс компоненты способностью порождать объект.
<vip>
<vip>
interface iMyInterface
interface iMyInterface
Строка 89: Строка 86:
...
...
</vip>
</vip>
Базовый интерфейс будет содержать также необходимые [[Pzl-Компонента#Предопределенные константы интерфейса pzl-компоненты|атрибуты базового интерфейса]].  
Base Interface contains also all needed constants [[Pzl-Component#Predefined constants of the base interface of the pzl-component| all needed constants]].


Имя базового интерфейса Pzl-Компоненты не может совпадать с [[#Имя Класса|именем класса]]. Если это требование не соблюдается, то появится сообщение об ошибке.
The name of the base interface of the pzl-component may not be the same as the [[#Class Name|name of the class]]. If this demand is not maintained, then the error message appears.


[[Изображение:PzlStudio NewComponentError SameName.png]]
[[Image:PzlStudio NewComponentError SameName.png]]


Имя базового интерфейса не может быть пустым.
The name of the base interface may not be empty.


==Имя Класса==
==Class Name ==
Имя класса определяет базовый класс компоненты, то есть класс, который будет использован для создания экземпляра компоненты.
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.


<vip>
<vip>
Строка 105: Строка 102:
...
...
</vip>
</vip>
Имя базового класса Pzl-Компоненты не может совпадать с [[#Имя Интерфейса|именем интерфейса]]. Если это требование не соблюдается, то появится сообщение об ошибке.
The name of the base class of the pzl-component may not be the same as the [[#Interface Name|name of the interface]]. If this demand is not maintained, then the error message appears.


Имя класса не может быть пустым.
The name of the class may not be empty.


==Условное имя компоненты==
== Component Alias ==


Условное имя компоненты может быть любой (не пустой и не содержащей пробелов) строкой символов и служит для условного именования компонент, например "ТекстовыйРедактор".
The component Alias may be any (not empty, no spaces) sequence of chars and serves to identify the type of the component like "TextEditor".


==Идентификатор компоненты==
==Идентификатор компоненты==

Версия 09:05, 5 февраля 2008

Автор: Виктор Юхтенко

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.

PzlStudio CreateNewComponent.png

The list of properties is shown below

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.

PzlStudio CreatedNewComponentReport.png

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.

PzlStudio ChangeBaseComponentsDirectory.png

If you agree, then the new value will be used each time, when it participates in any operation.

Sub-Directory

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.

Component Name

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

Interface Name

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 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.

PzlStudio NewComponentError SameName.png

The name of the base interface may not be empty.

Class Name

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.

Component Alias

The component Alias may be any (not empty, no spaces) sequence of chars and serves to identify the type of the component like "TextEditor".

Идентификатор компоненты

Идентификатор компоненты при ее назначении в форме может быть:

  • либо любой (не пустой и не содержащей пробелов) строкой символов
  • либо строкой символов, соответствующей уникальному идентификатору UID.

Первая форма идентификатора получается простым набором текста, являющегося идентификатором компоненты

PzlStudio ComponentIDAsString.png

Вторая форма идентификатора получается нажатием кнопки справа.

PzlStudio ComponentIDAsUID.png

Автономная Запускаемость

Параметр Автономной Запускаемости (RunAble) определяет возможность выполнения компонентой своей функции самостоятельно.

В форме может быть выбрано одно из двух значений: Yes и No. Если выбрано Yes, то компонента будет поддерживать интерфейс SpbRun

interface iMyInterface
    supports pzlComponent
    supports spbRun
...

и в файле <Имя Компоненты>.pro будет создан код, который должен быть конкретизирован:

clauses
  spbRun(_UserText).

Пользовательский интерфейс

Параметр Пользовательский Интерфейс определяет тип пользовательского интерфейса и выбирается из списка возможных значений:

  • VPI - традиционный механизм графики
  • GUI - объектный механизм графики
  • Consol - консольный - без графического интерфейса.

Атрибуты из базовых свойств

Последние три позиции в форме

  • Company
  • Author
  • Copyright

устанавливаются в Базовых свойствах и здесь могут быть переопределены в случае, отличном от типового. Если Вы их здесь изменили, то значения этих параметров в Базовых свойствах не изменяются.

Ссылки