How to Click on ListBox Item when....

May 5, 2008 at 12:37 PM
How To click on Listbox Item when I use core.dll it is not helpfull when ListBox item text is to small. I need click exactly on the text. (UIAutomation)
Coordinator
May 6, 2008 at 6:07 AM
White would click on the center of the ListItem. I would find out if there is a way of specifying, click on the text.
If you want to click at a particular point you can do something like this

ListItem item = listBox.Items.Find(...);
Point point = new Point(item.Bounds.X + 1, itemBounds.Y + 1);
window.Mouse.Click(point);

This is not exact code which probably would work for you, just giving you an idea of how to click at a particular point.
Please do get back if you need more help.
May 7, 2008 at 12:37 PM
I am using following code..

SearchCriteria searchChannel = SearchCriteria.ByAutomationId("").AndControlType(typeof(ListItem)).AndByText("ChannelProperties");
ListItem lstChannel = (ListItem)theScreen.Get(searchChannel);
_lstChannel.Click();


I am not getting any lisBox.Find(...) method. I am getting Point. I know System.Drawing.Point only
window.Mouse.Click() not found.

In short please help me in getting above API.
Thanks
Coordinator
May 8, 2008 at 5:24 AM
1. You would not be able to find the listItem from the window. You would have to find the ListBox first and then find the ListItem from it. (I would put a compile time check for this in the next release)
2. To find listItem from ListBox you can do something like this. listBox.Items.Find(...your delegate here....)
Jul 18, 2008 at 7:35 PM
 Core.UIItems.ListBoxItems.ListBox results = window.Get<Core.UIItems.ListBoxItems.ListBox>("lstb1");
results.Select(2);

where lstb is the listbox, and
results.Select (2); its the item index, its works