Partilhar via


FormListControl.editLabels Method

Definition

Overloads

editLabels(Boolean)
editLabels()

Indicates whether users can modify item names in a form list control.

editLabels(Boolean)

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

Parameters

_value
Boolean

A Boolean data type that specifies whether users can modify item names in a form list control.

Returns

Applies to

editLabels()

Indicates whether users can modify item names in a form list control.

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

Returns

true if users can modify item names; otherwise, false.

Remarks

You must call the editLabels method before you add columns to a form list control; otherwise, the columns do not appear in the control.

The following example shows a call to the editLabels method to enable users to modify item names in the form list control. The DictField.label method returns a label for a specified table field that is added as an item to the form list control. 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 createForm2(Args _args) 
{ 
    Args args; 
    Form form; 
    FormRun formRun; 
    FormBuildDesign formBuildDesign; 
    FormBuildDataSource formBuildDataSource; 
    FormBuildListControl formBuildListControl; 
    FormListControl formListControl; 
    FormListItem formListItem; 
    FormListColumn formListColumn; 
    DictTable dictTable; 
    int idx4; 
    str string; 
    container conAccountNum; 
    CustTable custTable; 
    int numAccounts; 
    int i; 
    int item; 
    int numItems; 
    DictField dictField; 
    // 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::Report); 
    formListControl.height(120); 
    formListControl.widthMode(FormWidth::ColumnWidth); 
    formListControl.editLabels(true); 
    // Add a column to the form list control. 
    formListControl.addColumn(1, new FormListColumn("Column1",1,120)); 
    // 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); 
        dictField = new DictField(77,1); 
        formListItem = new FormListItem(dictField.label()); 
        item = formListControl.addItem(formListItem); 
    } 
}

Applies to