Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Moves a specified item in a form list control.
Syntax
public int moveItem(int Item, int InsertAt)
Run On
Client
Parameters
- Item
Type: int
An Integer data type that specifies the item to move.
- InsertAt
Type: int
An Integer data type that specifies the position in the list that the item is moved to.
Return Value
Type: int
An Integer data type that specifies the position in the list that the item is moved to.
Examples
The following example shows a call to the moveItem method to move an item to the tenth position in the form list control. The FormListControl.getCount method returns the number of items in the 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;
int idx4;
str string;
container conAccountNum;
DictTable dictTable;
CustTable custTable;
int numAccounts;
int i;
int item;
int numItems;
// Create the form header.
form = new Form();
// Add data sources to the form.
dictTable = new DictTable(77);
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 = new FormRun(Args);
formRun.run();
formRun.detach();
formListControl = formRun.control(idx4);
formListControl.viewType(FormListViewType::Report);
formListControl.height(120);
formListControl.widthMode(FormWidth::ColumnWidth);
// Add columns to the form list control.
formListControl.addColumn(1, new FormListColumn("Account Numbers",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);
}
formListControl.getCount();
formListControl.moveItem(2,10);
}