Jaa


FormListControl.singleSelection Method

Definition

Overloads

singleSelection(Boolean)
singleSelection()

Indicates whether multiple items can be selected in a form list control.

singleSelection(Boolean)

public:
 virtual bool singleSelection(bool _value);
public virtual bool singleSelection (bool _value);
abstract member singleSelection : bool -> bool
override this.singleSelection : bool -> bool
Public Overridable Function singleSelection (_value As Boolean) As Boolean

Parameters

_value
Boolean

A Boolean data type that indicates whether multiple items can be selected in a form list control.

Returns

Applies to

singleSelection()

Indicates whether multiple items can be selected in a form list control.

public:
 virtual bool singleSelection();
public virtual bool singleSelection ();
abstract member singleSelection : unit -> bool
override this.singleSelection : unit -> bool
Public Overridable Function singleSelection () As Boolean

Returns

true if multiple items cannot be selected; otherwise, false.

Remarks

Call the singleSelection method before you add items to a form list control; otherwise, the items do not appear in the control.

The following example shows a call to the singleSelection method to specify that multiple items can be selected. The while select statement retrieves account numbers from the CustTable table and then stores the data in a container. The items in the variable are added to the form list control by calling the FormListControl.addItem method.

static void testFormListControl(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildListControl formBuildListControl; 
    FormListControl formListControl; 
    FormListItem formListItem; 
    FormListColumn formListColumn1; 
    FormListColumn formListColumn2; 
    FormListColumn formListColumn; 
    DictTable dictTable; 
    int idx4; 
    str string; 
    container conAccountNum; 
    CustTable custTable; 
    int numAccounts; 
    int i; 
    int item; 
    int numItems; 
    boolean columnAdd; 
    // 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"); 
    formBuildDesign.caption("myForm"); 
    // Add a form list control. 
    formBuildListControl = 
 formBuildDesign.addControl(FormControlType::ListView,"List"); 
    idx4 = formBuildListControl.id(); 
    args = new Args(); 
    args.object(form); 
    // Create the run-time form. 
    formRun = classfactory.formRunClass(args); 
    formRun.run(); 
    formRun.detach(); 
    formListControl = formRun.control(idx4); 
    formListControl.viewType(FormListViewType::List); 
    formListControl.height(120); 
    formListControl.singleSelection(false); 
    // Add items to the form list control. 
    while select custTable 
        where custTable.AccountNum >= 
            "4000" && custTable.AccountNum <= "4040" 
    { 
        conAccountNum += [[custTable.AccountNum]]; 
    } 
    numAccounts = conlen(conAccountNum); 
    for(i = 1; i <= numAccounts; i++) 
    { 
        string = conPeek(conAccountNum,i); 
        formListItem = new FormListItem(string); 
        item = formListControl.addItem(formListItem); 
    } 
}

Applies to