createIterator

createIterator(): Iterator;

The createIterator method creates an iterator for the Dictionary class. Use an iterator associated with the dictionary to remember the current position in the dictionary. (For details about iterators, see the Iterator class.)

The following examples show the use of the iterator.

load() updating;
begin
    centreWindow;
    iter := app.myCompany.allCustomers.createIterator;
    iter.reset;
    iter.next(cust);
    if cust <> null then
       textBoxName.text    := cust.name;
       textBoxAddress.text := cust.address;
       textBoxContact.text := cust.contact;
       listBoxCustomers.listCollection(app.myCompany.allCustomers, true, 0);
       listBoxCustomers.listIndex := 1;
    else
       textBoxName.text := "No Customer Instances";
    endif;
end;

buttonFillRight_click(btn: Button input) updating;
vars
    count     : Integer;
    startTime : Time;
begin
    app.mousePointer:= self.MousePointer_HourGlass;
    startTime := app.clock.Time;
    listBoxRight.clear;
    textBoxRightStart.text := null;
    iter := app.myCompany.allProducts.createIterator;
    count := 1;
    while count <= listBoxRight.lines do
        iter.next(myProduct);
        listBoxRight.addItem(myProduct.name);
        count := count + 1;
    endwhile;
    if theArray = null then
        create self.theArray transient;
    else
        self.theArray.clear;
    endif;
    app.myCompany.allProducts.copy(self.theArray);
    listBoxScrollBar.min := 1;
    listBoxScrollBar.value := 1;
    listBoxScrollBar.max := self.theArray.size - listBoxRight.lines - 1;
    listBoxScrollBar.largeChange := (self.theArray.size/20).Integer;
epilog
    labelRight.caption :="Time Taken := " & ((app.clock.Time -
                          startTime).Integer/1000).String & " Seconds";
    app.mousePointer:= self.MousePointer_Arrow;
end;