Ide/Creating new Project Items/Creating a Dialog

From wiki.visual-prolog.com

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