Ide/Creating new Project Items

From wiki.visual-prolog.com

Jump to: navigation, search
IDE

Contents

Creating a Project

To create a new project you should activate the Project | New menu command. Then in the opened Project Settings dialog you should type in or select the desired project settings and press the Create button. The new project with the default parameters correspondent to your settings will be created.


Creating a Package

The basic units of code organization accepted in Visual Prolog v.7 are packages. We use packages in Visual Prolog to organize and structuring things. The use of packages ensures homogeneity in structuring principles among different projects. Packages define the standard for tool structuring, they ease sharing source code among projects.

By default, the IDE organizes projects into packages. When you create a new package in a project, the IDE creates:

  • The subdirectory into which the package files will be placed.
  • The package header file (i.e. NewPackage.ph) that describes the public view of the package. The package header file should be inserted by #include directives in all other packages that use the package. The package header file contains the list of public interfaces, the list of public classes, and some #requires directives.
    Names declared in public interfaces and classes are seen outside the package in all places where the package header file is included. #requires directives are used to guaranty that all packages required to use the package are included into the project.
  • The package implementation file (i.e. NewPackage.pack) produces a Visual Prolog compilation unit which is added to a set of project modules.

How to Create a New Package?

To create a new package in a project you should select the IDE menu command File | New. In the left pane of the appeared Create Project Item dialog you should select Package. Then the dialog accepts the following shape:

The New Package Dialog

Name:

In the Name edit control you should type in the name of the package being created (NewPackage in the picture).

Parent Directory

In the Parent Directory field you should type in or select (using the Browse button) the parent directory for the package. The package will be placed into the subdirectory of this parent directory. By default, when you activate this dialog, Parent Directory displays the directory selected in the project tree. If this directory is one of project subdirectories, then its path is displayed relatively to the project root directory.
In this Parent Directory the IDE creates a new subdirectory with the name correspondent to the specified package name. The package will be placed into this subdirectory.

After you fill in all required settings for the package, you can press the Create button. Then the IDE creates the package subdirectory, the package header file NewPackage.ph, and the package implementation file NewPackage.pack. (They will appear in the project tree in the Project Window after the created package is compiled.)

Packages

The concept of packages is used for grouping together several linked interfaces and classes. Packages can play a role of some class library. Packages can be used in your program instead of direct placing all these interfaces and classes into your program.

The package is a collection of several grouped together interfaces and classes. The package provides some common name to all these interfaces and classes. Each declaration or implementation of each interface or class from a package is placed in a separate file. Each filename (of these files) coincides with the name of a class or an interface that is declared or implemented in this file. All package files are stored in the same separate package directory. (If a package contains sub-packages, then they are placed in subdirectories of the package directory.)

Except for files with declarations and implementations of interfaces and classes, each package contains two special files: the package header (.ph) and the package implementation (.pack) files.

  • The package header file provides declarations of all names exported from the package. Therefore, the package header file should be inserted by the #include directive in each other package that uses some names exported from this package.
  • The package implementation file provides code implementing the package classes which can be compiled into an object file. The package implementation file should be included only once into a project that uses this package.

So using the concept of packages we can create sets of linked interfaces and classes grouped into packages. Once created package can be included (and used) in several programs without copying package sources into each project. The example of such set of packages is our Visual Prolog Foundation Classes (PFC).

Package Header Files

The package header file provides external view of the package.

  • It provides #include directives for all files containing declarations of all interfaces (.i fles) and all classes (.cl files) exported from the package (public interfaces and classes).
  • It contains #include directives for package header (.ph files) files of all packages publicly used by the package. Since these package header files provide declarations of all public names declared in them; therefore, all public names declared in these packages are also publicly visible from the package.
  • It contains some #requires directives. #requires directives define packages whose implementations (compiled code) have to A be accessible in order to use the package.

So the package header file provides declarations of all names exported from the package. Not only of exported names declared in the package itself, but also of all names declared in other packages that are included in the package header file.

A package header file should be inserted by #include directives in all places where the public names exported from the package should be visible.

A package header file does not produce any compiled code, but it is used while compilation to declare names exported from the package.

Usually a package header file has the PackageName.ph name.

Package Implementation Files

The package implementation file provides code implementing classes declared in the package. Compilation of the package implementation file generates object file that provides real implementations of classes declared in the package.

  • It contains the #include directive for the package header file.
  • It provides #include directives for package header files of external packages privately used by the package implementation. These header files provide declarations of all external names used in the package implementation (.pro) files.
  • It provides #include directives for files containing interfaces (.i files) privately used by the package implementation. These interfaces are only used inside the package implementation and are not seen externally.
  • It provides #include directives for files containing declarations of classes (.cl files) privately used by the package implementation. These classes are only used inside the package implementation and are not seen externally.
  • It provides #include directives for all files with class implementations (.pro files) that provides Prolog code implementing all classes declared the package.

Usually a package implementation file has the PackageName.pack name.

Creating a COM Package

Terminology Used in COM

The Component Object Model (COM) is a way for software components to communicate with each other. It is a binary standard that allows any two components to communicate regardless of what machine they are running on (as long as the machines are connected), what operating systems the machines are running (as long as they support COM), and what language the components are written in. COM provides location transparency: it does not matter whether components are in DLLs or in EXEs. COM components are binary units of code that include packaging and registration code and that create COM objects. Each COM component, in the COM programming model, is a programming structure encapsulating both data and functionality. It is defined and allocated as a single unit and the only public access to the COM data and functionality is through the programming interfaces.

Each COM is simply a program module: a DLL or an EXE file. It can contain one or more COM components. (In Microsoft MSDN terminology components are coclasses.) Each component knows about several interfaces. (In MSDN terminology - each component can support several interfaces.) Each component supports the default interface iUnknown. Using the iUnknown::queryInterface/2-> predicate from the iUnknown interface, one can retrieve references to all interfaces known to a component. Each interface can provide several predicates (methods).

The main aim of importing a COM component into your project is using predicates defined in this COM component. Therefore, the COM package generated for an imported COM component has to provide some wrapper (glue code) to methods implemented in the COM component. That is, the generated COM package must provide declarations of correspondent interfaces, predicates, and domains.

How to Create a New COM Package

To create a COM package providing the interface (wrapper) to some COM component, you should activate the File | New IDE command. Then in the left pane of the opened Create Project Item dialog you should select COM Package. Then the dialog accepts the following shape:

Creating New COM Package Dialog

After you fill in all required COM package settings, you can press the Create button. Then the IDE creates the package subdirectory, the package header file (XML.ph for the above picture), and the package implementation file (XML.pack for the above picture). They appear in the project tree in the Project Window after the created package is compiled.

Options

Name:

In the Name edit control you should type in the name (XML on the picture) of the COM package (wrapping package) being created.

Parent Directory

In the Parent Directory you should type in or select (using the Browse button) the parent directory for the package. The package will be placed into the subdirectory of this parent directory. If you specify a non-existing name, then this directory will be created. By default, Parent Directory displays the directory selected in the project tree when you activate this dialog. If this directory is one of the project subdirectories, then its path is displayed relatively to the project root directory. If Parent Directory is empty, than it is equal to the project root directory.
In the Parent Directory the IDE creates the new subdirectory with the name correspondent to the specified package name. (It is XML for the above picture.). The package will be placed into this subdirectory.

Source Group Box

Controls in this group box are used to specify a COM module (DLL or EXE) from which a component should be imported. It contains the following controls:

  • Type Library
    When this option is checked ON, then in the edit control you should specify a file that contains the type library describing the COM component.
    Press the Load button to activate the Load Type Library File dialog using which you can find and insert the name of the type library file into the edit control.

    Attention! Notice that you HAVE to press the Load button to enforce the IDE to load the COM information from the specified type library even if you directly type in the type library filename into the edit control.

    If a COM client (our program importing COM server components) needs using COM server predicates, then the client application must have information about predicates in COM server components. Predicates often return values and accept parameters. The COM client requires declarations of all these predicates (and domains) in order to use them. This information can be made known in several ways. The Microsoft recommended way is to create a type library. (Remember that type libraries do not provide Prolog declarations.) Type library information can be stored in files with the following filename extensions: .tlb (type library itself), .olb (multiple type libraries or foreign object libraries), .dll (COM DLLs can embed type library resources), .exe (COM EXEs can embed type library resources), .ocx (ActiveX controls).
  • TypeLib ID
    When this option is checked ON, then in the edit control you should specify the TypeLib ID of the type library for the COM component that you wish to import. The TypeLib ID is a universally unique identifier (UUID) under which the type library is registered in the Windows system registry. (See CLSID for more information.) The TypeLib ID should be specified as a string of hexadecimal numbers with the following format:
    {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
    Then you MUST press the Load button to enforce the IDE to load COM information from the type library registered with this TypeLib ID.
    In the system registry database you can find all registered TypeLib IDs under:
    HKEY_CLASSES_ROOT\TypeLib = {TypeLib ID}
  • CLSID
    When this option is checked ON, then in the edit control you should specify the CLSID of the COM component that you wish to import. The CLSID should be specified as a string of hexadecimal numbers with the following format:
    {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
    Then you MUST press the Load button to enforce the IDE to load COM information from the COM module that embeds the COM component with the specified CLSID.

    Note. Really a COM module can embed several COM components. If you wish to import one of these COM components, then you can specify a CLSID registered to any COM component in this COM module. (Later you will be able to specify the required COM component (or interface) in the list box.

    In MSDN terminology, CLSID is a class identifier. In the Visual Prolog PFC terminology (see the COM package description in the PFC) CLSID is a COM component identifier.
    CLSID is a universally unique identifier (UUID) that identifies the type of a COM component. Each COM component has its CLSID in the Windows system registry database so that it can be loaded and used by other applications. For example, a spreadsheet can create worksheet components, chart components, and macrosheet components. Each of these components has its own CLSID that uniquely identifies this component to the system. That is, if your COM module (COM server or COM container) allows linking to its embedded components, then you need to register the special CLSID for each COM component embedded into the COM module.
    The CLSID is stored in the Windows registry database under the following registry key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID = {CLSID}
    The CLSID is a 128-bit number (in the hexadecimal format) within a pair of curly braces. Typically, CLSIDs (and other UUID values) are represented as strings of hexadecimal numbers with the following format:
    {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
    For example,
    {4208fb66-e22a-11d1-a7d7-00a0c982c00d}
    You can use the UUIDGEN.exe tool to create a new UUID.
    When you find a CLSID you can find the associated PROGID under the following registry sub-key:
    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{CLSID}\ProgID = <programatic identifier>
    See the PROGID options description below.

    Universally unique identifier (UUID)

    The universally unique identifier (UUID) is also known as the globally unique identifier (GUID). The UUID, or GUID, is a unique, 128-bit value used to identify objects. Objects can be OLE servers, interfaces, client objects, etc. Beginning from this moment objects will be identified with UUIDs.
  • PROGID
    When this option is checked ON. In the edit control you should specify the PROGID of the COM module from which you wish to import the COM component. The PROGID should be specified as a string of the following format:
    <Program>.<Component>.<Version>

    Words are separated by dots as in Word.Document.6. (Blank spaces cannot be used.)
    Then you MUST press the Load button to enforce the IDE to load COM information from the COM module registered with this PROGID.
    PROGIDs are versioned programmatic identifiers. PROGIDs present human-readable versions of class identifiers (CLSID) used to identify COM components. PROGID is a registry entry that can be associated with CLSID. Like CLSID, PROGID identifies a COM component but with less precision because it is not guaranteed to be globally unique. The Version portion is optional but strongly recommended. Using Version, even if there is only one version of the PROGID, helps to avoid conflicts. It enables different versions of a component coexist without overwriting PROGIDs. If you do not specify a version for a PROGID, the default Version = 1.
    How to find PROGID entries in the registry is described in the CLSID.
  • IID
    When this option is checked ON, then in the edit control you should specify the IID of the COM component interface that you wish to import.
    IID is a universally unique identifier (UUID) that uniquely identifies a particular COM interface. IID should be specified as a string of hexadecimal numbers with the following format:
    {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
    Then you MUST press the Load button to enforce the IDE to load COM information from the COM module that embeds the interface with the specified IID.
    Really you can specify an IID registered to any interface embedded into the same COM module that embeds the interface you wish to import. (Later you will be able to specify the required COM component (or interface) in the list box.
    In the system registry database you can find all registered IIDs under:
    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Interface

Creating an Interface

An interface definition defines the named object type. All predicates declared in an interface are object members in objects of the interface type. To create a new interface and to add it into one of the packages registered in the project you should activate the File | New IDE command. In the left pane of the opened Create Project Item dialog you should select Interface. Then the dialog accepts the following shape:

The New Interface Dialog

Name:

In the Name edit control you should type in an interface name (the interfaceName on the picture).

Package:

In the Package list button you should select one of the packages registered in the project (the NewPackage.pack on the picture). The created interface will be included into this package. The created file with the default declaration of this interface will be placed into the selected package subdirectory. This subdirectory name is displayed after the package name; it is (NewPackage\) in the picture.

After you fill in all required settings you can press the Create button. The IDE creates the interface definition file (it appears in the project tree in the Project Window after compilation of the package) and the #include @"NewPackage\interfaceName.i" directive is added into the package header file NewPackage.ph of the specified package:

% exported interfaces
#include @"NewPackage\interfaceName.i"

Since the package header file should be inserted by the #include @"NewPackage.ph" directive in all places, where the package is used, so in all these places the #include @"NewPackage\interfaceName.i" directive also be seen. This means that the interface interfaceName is public.

If you wish to create an interface that should be private to the NewPackage package, then the include directive for this interface can be manually moved into the package implementation file NewPackage.pack:

% private interfaces 
#include @"NewPackage\interfaceName.i"

Therefore, the interface declaration will not be seen outside of the package implementation. So the interface will be private to the package implementation.

Notice that information about a new interface does not appear in the project browse information until the package including this interface is compiled.

Creating a Class

The declaration of a class defines how the class appears to the surroundings. The surroundings can see and use only those constants, domains, and predicates that are declared in the class declaration. If the class states an interface as the construction type, then the class can construct objects of that type. Everything mentioned in the class declaration belongs to the class, rather than to objects it constructs. Any class declaration must have the accompanying class implementation. The definitions of the predicates declared in the class declaration should be provided by the class implementation.

To create a new class and to add it into one of packages registered in the project you should activates the File | New IDE command. Then in the left pane of the opened Create Project Item dialog you should select Class. Then the dialog accepts the following shape:

The New Class Dialog

Name:

In the Name edit control you should type in a class name (the newClassName on the picture).

Package:

In the Package list button you should select one of the packages registered in the project (the NewPackage.pack on the picture). The created class will be included into this package. The created files of this class will be placed into the selected package subdirectory. This subdirectory name is displayed after the package name; it is (NewPackage\) in the picture.

In namespace

The In namespace check box controls whether the class will be put into the namespace (e.g. namespace1\newClassName). This allows the same interface/class name to be declared/defined in several name spaces in the same program.

After you fill in all required settings for the class, you can press the Create button. Then the IDE creates the class declaration and the class implementation (if New Interface was checked ON) files. These files will appear in the project tree in the Project Window after compilation of the package) and the #include @"NewPackage\newClassName.cl" directive will be added into the correspondent package header or the package implementation file.

Notice that information about a new class does not appear in the project browse information until the class is compiled. To compile a new class, you can, for example, execute the Compile command for the package containing this class.

Creating a Text File

To create a new text file in the project you should use the File | New IDE command. In the left pane of the opened Create Project Item dialog you should select Text File. Then the dialog accepts the following shape:

The New TextFile Dialog

Name:

In the Name edit control you should type in the name of the text file (the TextModule.pack on the picture).
Notice that if you type in a filename without a filename extension, then the default extension .TXT is added.

Parent Directory

In the Parent Directory you should type in or select (using the Browse button) the parent directory. The created text file will be placed into this directory.

Add to Project as Module

If it is checked ON, then the created text file will be seen in the Project Tree in the Project window.
Notice that this feature is relatively smart. Its behavior depends upon the filename extension of the text file. If you specify the .PACK extension, for example TextModule.pack, then the IDE understands that the created file can be a real project module (can be a compilation unit) and adds to the project make scripts correspondent commands to compile the module and use the obtained object (.OBJ) file for project linking.
If Add to Project as Module is checked OFF, then the created text file will NOT be seen in the Project Tree in the Project window, and it will not be registered as a project module.

After you fill in all required settings for a new text file, you can press the Create button.

Creating a Dialog

To create and register a new dialog in a project you need to use the File | New menu command. Then the Create Project Item dialog will look like:

Ide NewDialog Dialog.png

Name

In the Name field you should type in the name, which will be associated with this dialog in the automatically generated code. This name should be a correct Visual Prolog name. It should be any sequence of letters, digits, and underscores, beginning with a letter. This name is used to generate names of files handling the dialog. These files appear in the project tree in the Project window. The Code Expert uses this name for names of predicates handling the dialog.

Package

You should check one of the New Package or Existing Package radio buttons to specify whether the generated resource file, interface and class, which handle the dialog, will be included to the new package that will be created or will be included to the existing one.
If you check the New Package button, then you can specify the parent directory name in the Parent Directory field. The package and the dialog handling files will be created and placed into the parent directory.
If you check the Existing Package button, then in the Package list button you should select one of the packages known to the project. The files handling the created dialog will be included into this package. The created files will be placed into the selected package subdirectory

In namespace

If this flag is checked, then it is possible to define a namespace in which the correspondent automatically generated interface, class declaration and class implementation will be placed.

After you fill in all required settings, you should press the Create button, then the Dialog Properties/Attributes dialog appears.

Dialog Properties and Attributes

When you create a dialog it looks like:

Ide DialogAttributes Dialog0.png

Title

At runtime this text appears in the title of the dialog window. This field is ignored if the Titlebar property is set to false or Titlebar check box is not checked.

Dialog Type

It is the Type property. Values Modal and Modeless can be set.
If the Modal property is set to true, then the created dialog will be modal. Modal dialogs prohibit activation of another windows or dialogs in the same application until the modal dialog is closed.
If the Modal property is set to false, then the created dialog will be modeless.

Style Flags

Set of properties that control the look of the dialog. When some option is set to true, then the correspondent property is set to the dialog.
  • Titlebar
    When this attribute is set to true or is checked, the dialog will have a title bar.
  • CloseBox
    When this attribute is set to true or is checked, the dialog will have a close box.
  • MaximizeBox
    Creates the maximize box in the title bar of the dialog window.
  • MinimizeBox
    Creates the minimize box in the title bar for the dialog window.
  • Invisible
    When the dialog will be opened the first time, it will be invisible. Notice that, even if a modal dialog is created with the Invisible option, it will be initially visible.
    The programmer can make a modal dialog invisible by the call to
    window::setState([vpiDomains::wsf_Invisible,...])
  • Disabled
    Determines that the dialog will be displayed as disabled (grayed) when it will be first opened.
  • ClipSiblings
    Specifies that two dialogs with the same parent window should use clipping.
  • ClipChildren
    Specifies that drawing over any child windows should be clipped.
  • HorizScrollbar
    When it is set to true, the dialog includes a horizontal scroll bar.
  • VertScrollbar
    When it is set to true, A the dialog includes a vertical scroll bar.
  • ChildDialog
    Specifies that the dialog window has behavior similar to child windows. This means that:
    • The dialog window is restricted to stay inside the client rectangle of its parent window.
    • The dialog window can be partially or completely obscured by any overlapping windows.
    • Under MDI mode. When the parent window of the dialog is a task window, then the created dialog is (usually) initially hidden (obscured by other windows).
    It is disabled if the Modal property is set to true.
  • SizeBorder
    When it is set to true, the dialog gets double border (such dialogs can be resized).

Position
Size

Two properties that determine the position and the size of the dialog. The coordinates are given in Dialog Base Units. One unit in the X direction is equal to one quarter of the width dialog base unit. One unit in the Y direction is equal to one eighth of the height dialog base unit. The dialog base units are computed from the height and width of the system font.

Font

The property for with which you can select attributes of the font used in controls of the dialog. Note that the selected font is not seen while dialog editing, but using the Resource | Test Mode command it is possible to see how the dialog will look like. The Dialog Base Unit size is scaled by the operating system depending upon the font size - but note that bitmaps and icons are not scaled. Be careful not to specify any fonts that may not exist in the environments where your application might be used.

Default Button

Specifies the default button for a dialog. This button action is called when the user presses the Enter key.

After you fill all the required attributes you may click the OK button. Clicking the OK button you create the new dialog in the current project.

The properties panel is always present in design mode.

After you compile the package in which the created dialog is included, the project tree starts to display files handling the dialog (the interface, the class, and the implementation).

Creating a Form

Forms can be created in any Graphical User Interface projects (see description of forms in the GUI package overview in the PFC part of Help). To create and register a new form in a project you need to use the File | New menu command. In the opened Create Project Item dialog you should select the Form type of created item. Then the Create Project Item dialog accepts the following shape:

Ide MyForm New.png

Name

In the Name field you should type in the name, which will be associated with this form in the automatically generated code. This name should be a correct Visual Prolog name. It should be any sequence of letters, digits, and underscores, beginning with a letter. This name is used as names of files generated for handling the form. These files appear in the project tree in the Project window. The Code Expert uses this name for generation of names of predicates that handle the form.

Package

You should check one of the New Package or Existing Package radio buttons to specify whether the generated resource file, interface and class, which handle the form, will be included to the new package that will be created or will be included to the existing one.
If you check the New Package radio button, then you can type in the directory name in the Parent Directory field. The package and the form handling files will be created and placed into the parent directory.
If you check the Existing Package radio button, then in the Package list button you should select one of the packages known to the project. The files handling the created form will be included into this package. The created files will be placed into the selected package subdirectory.

In namespace

If this flag is checked, then it is possible to define a namespace in which the correspondent automatically generated interface, class declaration and class implementation will be placed.

After you fill in all required settings, you should press the Create button, then the Form Properties dialog appears.

Form Properties Dialog

Ide myForm Properties.png

Possible options for the Form Properties dialog are:

Title

At runtime this text appears in the title of the form.

Style Flags

These properties define the style flags, which control the look of the form (and affect the generated codes).
  • TitleBar
    When this option is set to true the form will have a title bar.
  • CloseBox
    When this option is set to true the form will have a close box. It is disabled if the TitleBar is not chosen.
  • MaximizeBox
    When this option is set to true the form will have a maximize box. It is disabled if the TitleBar is not chosen. Do not specify this flag if the window should not be resized.
  • Minimize Box
    When this option is set to true the form will have a minimize box. It is disabled if the TitleBar is not chosen. Do not specify this flag if the window should not be resized.
  • Visible
    When this option is set to true the form is visible when it is opened the first time.
  • Enabled
    When this option is set to false the form is displayed as disabled (grayed) when it is opened the first time.
  • ClipSiblings
    When this option is set to true, if this form and some other window have the same parent window, then these child windows should use clipping.
  • ClipChildren
    When this option is set to true, then drawing over any child windows should be clipped.
  • Maximized
    When this option is set to true, then the form should be initially displayed maximized.
  • Minimized
    When this option is set to true, then the form should be initially displayed minimized.
  • VertScrollbar
    When this option is set to true, then the form will have a vertical scroll bar.
  • HorizScrollbar
    When this option is set to true, then the form will have a horizontal scroll bar.
  • Border
    You can can select which style of border the form will have:
    • Size Border Form has a double border. It is used to resize the form.
    • Thin Border Form has a thin border. The form cannot be resized.
    • Dialog Border Form has a border like a dialog. The form cannot be resized.
    • No Border Specifies that there should not be any border around the form.
  • Menu
    Using Menu you can select which of registered in the project menus should be assigned to the form. Usually this is the TaskMenu. If the form should not have a menu, then select the unset.
  • Assigned Toolbars
    Here a programmer can assign to the form any of existing toolbars.

Font

With controls in this group you can select attributes of the font used in controls of the form. When the Set Form Font check box is checked, the Font button can be used to select font properties in the standard font dialog. Note that the selected font is not seen while the dialog editing, but using the Resource | Test Mode command it is possible to see how the form will look like. The Dialog Base Unit size is scaled by the operating system depending upon the font size - but note that bitmaps and icons are not scaled. Be careful not to specify any fonts that may not exist in the environments where your application might be used.

Default Button

Specifies the default button for a form. This button action is called when the user presses the Enter key.

After you fill all the required attributes you may click the OK button. Clicking the OK button you create the new form in the current project. You can always go back and activate (with the Resource | Attributes... task menu command or with the Attributes... item from pop up menu) the Form Properties dialog to change the form properties.

Editing a Form

To edit a form, double-click (or press Enter) the name of the form description file (the .FRM filename extension) in the project tree. The IDE Designer with the form appears. Here you can place controls and execute any other editing operations with the form.

Editing a form in the IDE Designer is nearly the same as editing a dialog.

Creating a Toolbar

To create and register a new toolbar in a project you need to use the File | New menu command. In the opened Create Project Item dialog you should select in the left pane the Toolbar type of created item. Then the dialog will accept the following shape:

Ide MyToolbar New.png

Name

In the Name field you should type in the name, which will be associated with this toolbar in the automatically generated code. This name should be a correct Visual Prolog name. It should be any sequence of letters, digits, and underscores, beginning with a letter. This name appears in names of files generated for handling the toolbar. These files appear in the project tree in the Project window. The Code Expert uses this name for generation of the name of class, which handle the toolbar.

Package

You should check one of the New Package or Existing Package radio buttons to specify whether the generated resource file and class, which handle the toolbar, will be included to the new package that will be created or will be included to the existing one.
If you check the New Package radio button, then you should type in the directory name in the Parent Directory field; it is (TaskWindow\) in the picture. The package and the toolbar handling files will be created and placed into the parent directory.
If you check the Existing Package radio button, then in the Package list button you should select one of the packages known to the project (the TaskWindow.pack in the picture). The files handling the created toolbar will be included into this package. The created files will be placed into the selected package subdirectory. The name of this subdirectory is displayed after the package name; it is (TaskWindow\) in the picture.

Toolbar Attributes Dialog

After you press the OK button in the Create Project Item dialog, the Toolbar Attributes dialog appears.

Ide ToolbarAttributes.png

The possible settings for a toolbar are:

Style

There are several toolbar styles. And since the layout of a toolbar simply shows the order of the controls it is easy to change the toolbar style.
The toolbar Style can be one of the following:
Toolbar Style Toolbar Location
Top Placed at the top of window
Left Placed at the left side of the window
Bottom Placed at bottom of window
Right Placed at the right side of the window
Inside Placed at a fixed location inside the window. (The Graphics Editor uses several of these)
Movable A floating toolbar, which the user can move around
Try to change the toolbar style to see the various layouts.

Title

Sets the title for the toolbar. It is disabled for all toolbar styles except for the Movable.

Position

Shows the toolbar position. The position can be set for the Inside and Movable toolbar styles.

Code

This group box contains the read only Class Name text field and the Update Code push button.
  • Class Name
    In this read-only control you can see the name of the class in which the IDE places the default code for the toolbar.
  • Update Code
    Click this push button to enforce code updating.

After clicking the OK button the new toolbar will be created and its name will be added to the existing toolbars for the current project. You can always go back and wake up the Toolbar Attributes dialog (with the Resource | Attribute task menu item or with the Attribute item from pop up menu) for the toolbar to change any of the toolbar attributes.

Creating a Menu

To create and register a new menu in a project you need to use the File | New menu command. In the opened Create Project Item dialog you should select the Menu type of created item. Then the dialog will accept the following shape:

Ide MenuNew.png

In this dialog you should specify the following items:

Name

In the Name field you should type in the name, which will be associated with this menu in the automatically generated code. This name should be a correct Visual Prolog name. It should be any sequence of letters, digits, and underscores, beginning with a letter. This name appears as the name of the files storing the menu description (with .mnu extension). This file appears in the project tree in the Project window.

Parent Directory

In the Parent Directory field you should type in the parent directory (the TaskWindow\ on the picture). The menu resource file will be placed into the selected directory.

Menu Attributes Dialog

After you press the OK button in the Create Project Item dialog, the Menu Attributes dialog appears.

Ide MenuAttributes.png

After clicking the OK button the new menu will be created and its name will be added to the list of menus existing in the current project. You can always go back and wake up (with the Resource | Attribute task menu item or with the Attribute item from pop-up menu) the Menu Attributes dialog for the menu. The only possible setting for menu attributes is:

  • Constant
    In this list edit the programmer can change the default resource constant for the menu (at the picture it is id_mymenu). A menu identifier must be unique throughout the project.
  • Resourse File
    In this read-only field the programmer can see the name of the file in which the creating menu resource will be stored.

Creating a New Image (Bitmap, Cursor or Icon)

To create and register a new image (a bitmap, an icon or a cursor) in a project you need to use the File | New menu item. In the opened New dialog you should select the Bitmap, the Icon or the Cursor type of creating item. Then the following dialog (in case if you have selected the Bitmap) appears:

Creating a new bitmap image

In this dialog you should specify the following items:

Name

In this dialog you should type in the Name which will be associated with this image in the code generated by default. This Name should be a correct Visual Prolog name. It should be any sequence of letters, digits, and underscores, beginning with a letter. This is the name of the creating image. It appears as the names of image files in the project tree in the Project window.

Package

With the Package selection the programmer can determine into directory of which package will be placed the image file.

Image Attributes Dialog

After you press the OK button in the New Bitmap dialog, the Bitmap Attributes dialog appears. The similar dialogs appear in case if you will create a cursor or an icon.

The Bitmap Attributes dialog while creation of a new bitmap

After clicking the OK button the new bitmap will be created and its name will be added to the existing bitmaps for the current project.

The similar (but little simpler) dialogs appear when you create a new Icon:

The Icon Attributes dialog while creation of a new icon

and a new Cursor:

The Cursor Attributes dialog while creation of a new cursor

In these dialogs you can change only the Constant attribute. The attributes Name and File are generated automatically and cannot be changed by the programmer.

Name

This is the Name which was specified for the image in the previous New dialog. It cannot be changed here.

File

Here you will see the name of file, with the path relative to the project root directory, in which the image will be stored. This filename is generated automatically by the IDE and cannot be changed.

Constant

The constant is used to identify the image in your program. An image identifier must be unique throughout the project.

You can either input it directly from the keyboard or allow the IDE to create a default value.
The default values for constants are:
Image Type Constant
Bitmap idb_bitmap_name
Icon idi_icon_name
Cursor idc_cursor_name
Constant must be either legal symbolic constant name (for example, idb_mybitmap) or an integer. The IDE automatically places the symbolic identifier into the ResourceIdentifiers.i file and generates an integer value for it. The Graphics Editor automatically concatenates a sequence number if the project already has an image with the same name.
In case of Icons and Cursors this is the only attribute which can be edited in this dialog.

In case when you create a new bitmap, you can specify several additional attributes:

Width and Height

Defines the Width and Height of the bitmap in pixels. The maximal possible values are 64.
You may specify the size of the image for bitmaps only. The Graphics Editor allows you to create and edit bitmaps ranging in size from 4x4 pixels to 64x64 pixels.
The size of icons and cursors is always 32x32.

Colors

In this field you may specify using of either a 16-color palette or monochrome shadow palette for bitmaps and icons. Remember that for creating cursor images only 2 colors are available - the color black and transparent for background "color".
Personal tools