Phantom Documentation

[Help Home] [Phantom Home]
ListBox Functions

The following functions are for use with the ListBox type class.

            Select
            SelectString
            GetCount       
            GetElement
            GetSel


Example Code

use "PhantomTarget.dec";
System("PhantomTarget.exe");

# Open the ListBox
PhantomTarget._Controls._ListBox.Select();

# Add some items to the list box
ListBox.Edit1.SetText("Item 1");
ListBox._Insert.Click();
ListBox.Edit1.SetText("Item 2");
ListBox._Insert.Click();
ListBox.Edit1.SetText("Item 3");
ListBox._Insert.Click();

# Get the number of elements in the list
int iCount = ListBox.ListBox1.GetCount();
string s;
disp(iCount);

# Cycle through the elements, selecting
# each one and getting its text
for(int i = 0; i < iCount; i++){
  ListBox.ListBox1.Select(i);
  disp(ListBox.ListBox1.GetSel());
  s = ListBox.ListBox1.GetElement(i);
  disp(s);
}

# Selet an element by its string name
ListBox.ListBox1.SelectString("Item 2");

# Exit out
ListBox.OK.Click();
PhantomTarget.Close();



See Also: ListBox Class



Copyright 2000-2011 Phantom Automated Solutions