Form Class

A form is a window that acts as a container for controls that display information and that permit user input. As the Form class is a subclass of the Window class, it inherits all of the properties and methods defined in that class. A form can be one of the following types.

An MDI form without a caption can always be maximized programmatically. However, if the user switches between MDI children (for example, by using the Ctrl+F6 key combination), the next form is displayed in a maximized state only if the value of the maxButton property for that form is true. This property is used for this situation even if the value of the controlBox property is false, meaning that none of the MDI buttons or the control icon are displayed on the menu line.

Forms have properties that determine aspects of their appearance (for example, position, size, and color), and aspects of their behavior (for example, whether they can be resized). Forms can also respond to events initiated by the user or triggered by the system. For example, you could write logic in the click event method of a form that would enable the user to change the color of a form by clicking it. (For details about creating forms when a workstation has multiple monitors, see "Window Class", earlier in this document.)

In addition to properties and events, you can use methods to manipulate forms from logic. For example, you can use the move method of the Window class to change the location of a form or control. This effectively changes more than one of the left,top, width, or height properties of the form or control. As each change causes the control to resize, potentially each control resizes each time the properties are set (or the control is aligned to the form or control if the window is a container of other controls). The move method ensures that one resize only occurs. For example, if you individually change the left, top, width, or height properties for a folder, the folder resizes four times. It then resizes the sheets four times, which can resize the contents, and so on.

If a form has the mdiFrame property set to true, that form is automatically created as an MDI frame; that is, a special kind of form that can contain other forms (MDI child forms). If a form has the mdiChild property set to true, that form is automatically placed in a special kind of form called an MDI frame that can contain these MDI child forms.

New instances of a form can be created in logic by using the create method, and then displayed by using the show method or the showModal method, as shown in the following example.

vars
    form : InquiryForm;     // declare the form to be of type InquiryForm
begin
    create form;            // create the form window
    form.show;              // display the window
end;

The show method or the showModal method causes the windows to be made visible. Using the showModal method causes all other forms of that application to be disabled until that form is unloaded. Execution of the showModal method completes only when the form is unloaded, or made invisible. The show method is invoked and starts execution before the load event method is invoked.

Within the show method, it is the presence of an inheritMethod call that causes the load event method to be invoked. Consequently, any user logic positioned prior to the inheritMethod call is executed before the load event method executes.

The load event of a form is executed when the first event for the form occurs. This is normally when the initial show or showModal statements are executed. This delayed execution of the form load event means that logic can set and alter properties and controls on the created form before the load event is executed.

Set the borderStyle property to define the border of a form, and set the caption property to put text in the title bar. Setting the borderStyle property to BorderStyle_None removes the border (if the form does not have a menu). If you want your form to have a border without the title bar, Control-Menu, Maximize button, or Minimize button, delete any text from the caption property of the form, and set the controlBox, maxButton, and minButton properties for the form to false.

Windows will not create a form that has a caption line with a single border but instead creates a form with a fixed double border. If the value of the borderStyle property is set to BorderStyle_Single (1) and the form has a caption line, the value of the borderStyle property is modified to fixed BorderStyle_Double (3), to reflect the actual border style in use.

To force a form defined with the mdiChild property set to 0 (use application MDI default) to be specifically an MDI form or non-MDI form, set the Application class defaultMdi property before the create method is used.

When printing the text of a control or displaying the text on a form, an ampersand character (&) is displayed as an underscore to the next character of the text string, with the following exceptions.

For controls that display an ampersand character (&) as an underscore, two ampersand characters (&&) are printed or displayed as a single ampersand character; for example, &&Print is printed or displayed as &Print.

For details about applying skins to forms in your application, see "JadeSkinApplication Class" and "JadeSkinForm Class", in Chapter 1. For a summary of the constants, properties, methods, and events defined in the Form class, see "Form Class Constants", "Form Properties", "Form Methods", and "Form Events", in the following subsections.

For details about programmatically providing the functionality to float, dock, and pin MDI child forms in your own application logic and providing tabs on MDI forms, see "Floating, Docking, and Pinning MDI Child Forms" and "MDI Child Form Tabs", respectively, in later subsections.

For details about testing controls on a form, see "Testing Tools and Control Identification", later in this document. For details about the support of mouse wheel requests to scroll up, down, or across a form, see "Window Class", earlier in this document. For details about monitoring the basic operating style of forms for a Jade application, see "Monitoring the Basic Operating Style of Forms", in the following subsection.

From Jade release 2022.0.04, menu bars on forms and menu items have been updated to support accessibility. The Jade Platform menu bars expose their location for MDI frame forms and non‑MDI forms. In addition, the name, location, and state are exposed for each menu item in the hierarchy of a menu bar.

The MenuBar is exposed as a direct child of a Form. Menu items are children of the menu bar. In multi‑hierarchical menus, a menu item may have multiple menu item children.

This feature is enabled by setting the EnhancedAccessibilityEnabled and AccessibilityEnabled parameters to true in the [Jade] start‑up section of the Jade initialization file.

The following restrictions apply.

Window

ControlAboutBox, JadeBackupDatabaseDialog, JadeFrameForm, JadePrintPreviewFind, JadeSkinMaint, JadeSkinMaintenance, JadeSkinSelect, JadeSkinSelection, JadeTestDialog, JadeWebServiceShowStats, and user-defined Form classes