Ide/Creating new Project Items/Creating a Form

From wiki.visual-prolog.com

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.