Controls.Find

Syntax:

Find(<Description>)

Parameters:

<Description> (required)

Type: String.
Form element description.

Returned value:

Type: Control on form; Undefined.
Control on form If the element is not found, then the value Undefined is found.

Description:

Searches for a control with a specified name.

Availability:

Thick client.

Example:

Procedure ActiveAttributInForm(DocumentForm) Export
    // Structure - order of attributes activisation.
    // First unfilled activates.
    AttributesStructure = New Structure;

    AttributesStructure.Insert("Date");
    AttributesStructure.Insert("Number");
    AttributesStructure.Insert("Organization");
    AttributesStructure.Insert("Bank");
    AttributesStructure.Insert("BankAccount");
    AttributesStructure.Insert("Warehouse");
    AttributesStructure.Insert("Contractor");
    AttributesStructure.Insert("Receiver");
    AttributesStructure.Insert("Payer");
    AttributesStructure.Insert("PhysBody");

    For 
each Item In AttributesStructure Do
        //Define whether control with this name exists
        CI = DocumentForm.Controls.Find(Item.Key);
        If 
CI  <> Undefined Then 
            // there is such an element
            If Not ValueIsFilled(CI.Value) Then 
                // there is no such element
                // make it current and break the cycle
                DocumentForm.CurrentControl = CI;
                Break
;
            EndIf
; 
        EndIf
;
    EndDo
; 
EndProcedure


    

1C:Enterprise Developer's Community