form

Type: Form

Availability: Read-only at run time

The form property of the Control class and MenuItem class contains a reference to a form of a control or menu from the object.

Use this property when the control or menu object is passed as a parameter to a generalized method, so that the logic can still access the form of the control or menu.

The code fragment in the following example shows the use of the form property.

if lbl = null then
    create lbl transient;
    lbl.parent := self;
    form.addControl(lbl);
    if isInPainter then
        lbl.actualEnabled := false;
    endif;
    lbl.borderStyle := BorderStyle_Single;
    lbl.alignment   := Alignment_Center_Middle;
    if lbl = monthLabel then
        lbl.caption := today.monthName;
    else
        lbl.caption := today.year.String;
    endif;
endif;