Share via


FormRun.contains Method

Indicates whether a form contains a specified control.

Syntax

public boolean contains(FormControl control)

Run On

Client

Parameters

  • control
    Type: FormControl Class
    A FormControl object that specifies a control on a form.

Return Value

Type: boolean
true if the form contains the specified control; otherwise, false.

Examples

The following example shows a call to the contains method to determine whether the form includes a string control. The method returns false. The string control that is created by using the new method is not added to the form.

static void createForm2(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildGridControl formBuildGridControl; 
    FormStringControl formStringControl; 
    FormGridControl formGridControl; 
    DictTable dictTable; 
    DictTable dictTable2; 
    int idx; 
    boolean controlExists; 
 
    // Create a string control. 
    formStringControl = new FormStringControl(); 
     
    // Create the form header. 
    form = new Form(); 
 
    // Add data sources to the form. 
    dictTable = new DictTable(tablenum(CustTable)); 
    formBuildDataSource = form.addDataSource(dictTable.name()); 
    formBuildDataSource.table(dictTable.id()); 
 
    // Create the form design. 
    formBuildDesign = form.addDesign("Design"); 
 
    // Add controls. 
    formBuildGridControl = 
 formBuildDesign.addControl(FormControlType::Grid, "Table Grid"); 
    formBuildGridControl.dataSource(dictTable.name()); 
    idx = formBuildGridControl.id(); 
 
    // Add a data field to the controls. 
    formBuildGridControl.addDataField(formBuildDataSource.id(), 
    dictTable.fieldName2Id("AccountNum")); 
 
    args = new Args(); 
    args.object(form); 
 
    // Create the run-time form. 
    formRun = new FormRun(Args); 
    formRun.run(); 
    formRun.detach(); 
 
    // Check if the form contains a string control. 
    controlExists = formRun.contains(formStringControl); 
}

See Also

Reference

FormRun Class