FormListControl.getItemPos(Int32) Method

Definition

Retrieves the position of an item in a form list control.

public:
 virtual cli::array <System::Object ^> ^ getItemPos(int _Item);
public virtual object[] getItemPos (int _Item);
abstract member getItemPos : int -> obj[]
override this.getItemPos : int -> obj[]
Public Overridable Function getItemPos (_Item As Integer) As Object()

Parameters

_Item
Int32

An Integer data type that specifies an item in a form list control.

Returns

Object[]

A Container data type that contains the position of an item in a form list control. The position of an item is specified by an x-coordinate and a y-coordinate.

Remarks

Use the conPeek function to extract an item from a container.

The following example shows a call to the getItemPos method to return the position of each item in 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; 
    DictTable dictTable; 
    int idx4; 
    boolean columnadd; 
    str string; 
    container conAccountNum; 
    container itemPos; 
    CustTable custTable; 
    int numAccounts; 
    int numItems; 
    int i; 
    int x; 
    int item; 
    // 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); 
    // Add an item 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); 
        itemPos = formListControl.getItemPos(item); 
        numItems = conlen(itemPos); 
        for(x = 1; x<= numItems; x++) 
        { 
            print conpeek(itemPos,x); 
            pause; 
        } 
    } 
}

Applies to