Skip to main content
Version: 5.x

FORM statement

The FORM statement creates a form.

Syntax

FORM name [caption] formOptions
formBlock1
...
formBlockN
;

After specifying the form name and caption, form options formOptions are specified in an arbitrary order

IMAGE path 
AUTOREFRESH period

After the form options, the blocks of the form formBlock1 ... formBlockN are described in the arbitrary order:

OBJECTS ... 
TREE ...
PROPERTIES ...
FILTERS ...
[EXTEND] FILTERGROUP ...
USERFILTERS ...
ORDERS ...
EVENTS ...
REPORT propertyExpression
FORMEXTID extID
EDIT className OBJECT objectName
LIST className OBJECT objectName

Description

The FORM statement declares a new form and adds it to the current module. In addition, this statement is used to describe the form structure, as well as its static and partially interactive (except form design) views. At the beginning of the statement, name and captions are specified, followed by form options and the declaration containing an arbitrary number of blocks describing the structure of the form. They can be used in any order, provided that each block is declared after the blocks whose elements it uses. Each block can be used any number of times.

Parameters

  • name

    Form name. Simple ID. The name must be unique within the current namespace.

  • caption

    Form caption. String literal. If the caption is not defined, the form's name will be its caption.

Form options (formOptions)

  • IMAGE path

    The relative path to the file with the image that will be used as the form icon.

    • path

      Path to the file. String literal. The path is relative to the images directory.

  • AUTOREFRESH period

    Specifying the automatic form update period. If the option is not specified, the form will not be updated automatically. deprecated since version 5, use EVENTS ON SCHEDULE refresh()

Form blocks (formBlock1 ... formBlockN)

Examples

CLASS Document;

// declaring the Documents form
FORM documents 'Documents'
// Adding one object of the Document class. The object will be available by this name
// in the DESIGN, SHOW, EXPORT, DIALOG, etc. operators.
OBJECTS d = Document


// ... adding properties and filters to the form

// marking that this form should be used when it is necessary to select a document,
// while the d object should be used as a return value
LIST Document OBJECT d
;

CLASS Item;

// declaring the Product form
FORM item 'Product'
// adding an object of the Item class and marking that it should be displayed
// in the panel (i.e., only one value is visible)
OBJECTS i = Item PANEL

// ... adding properties and filters to the form

// marking that this form should be used when it is necessary to add or edit a product
EDIT Item OBJECT i
;

// declaring a form with a list of Products
FORM items 'Products'
OBJECTS i = Item

// ... adding properties and filters to the form

// adding buttons that will create and edit the product using the item form
PROPERTIES(i) NEWSESSION NEW, EDIT
;

CLASS Invoice;
CLASS InvoiceDetail;

// declaring the invoice print form
FORM printInvoice
OBJECTS i = Invoice // adding an object of the invoice class for which printing will be executed

// ... adding properties and filters to the form
;

// splitting the form definition into two statements (the second statement can be transferred to another module)
EXTEND FORM printInvoice
// adding invoice lines, each of which will be used in the report as a detail
OBJECTS d = InvoiceDetail

// ... adding properties and filters to the form
;
// declaring an action that will open the invoice print form
print (Invoice invoice) { PRINT printInvoice OBJECTS i = invoice; }