ListView and TreeView Controls
Controls derived from SysTreeView32 and SysListView32 are supported using the following methods.
ListView
Method | Description |
---|---|
GetListItemCount | Return the number of items in the List |
GetListItemLocation | Return the location coordinates of the item with the given index number |
GetListItemText | Return the test of the item for the given index and column |
GetListItemPointFromName | Return the location of the item with the given name and column |
EnsureVisibleListItem | Scroll the list view to ensure the item given by an index number is visible |
SelectListItem | Set the item given by the index number to the selected state |
TreeView
Method | Description |
---|---|
GetTreeViewItemCount | Return the number of visible items in the Tree |
GetTreeItemLocation | Return the location coordinates of the item with the given name |
GetTreeItemRectange | Return the rectangle enclosing the item |
ExpandTreeItem | Return the location of the item |
EnsureVisibleTreeItem | Scroll the list view to ensure the item is visible |
SelectTreeItem | Set the item to the selected state |
GetTreeItemText | Get the text of the item for the given index number |
Example
This example shows a method for finding desktop Icon and double clicking it. The Windows desktop is a SysListView32 control.
public void LaunchDesktopItem(string name)
{
Control desktop = FindTopWindow("Program Manager");
Control listview = desktop.FindControl("FolderView");
for (int i = 0; i < listview.GetListItemCount(); i++)
{
if (listview.GetListItemText(i, 0).Equals(name))
{
Mouse.DoubleLeftClick(listview.GetListItemLocation(i));
return;
}
}
ExitVU("Failed to find desktop item: " + name, false);
}