Forum Discussion
Dmitry_Nikolaev
13 years agoStaff
Hi Saket,
Here is the correct script. Please let me know how it works for you:
function Test()
{
// The script works with the '<Infragistics>\NetAdvantage for .NET <version>\Samples\Win\WinListBar\CS\
// Appearances CS\bin\Appearances.exe' sample application
var groupName = "Group Two";
var itemName = "Item Two";
var ultraListBar = Sys.Process("Appearances").WinFormsObject("Form1").WinFormsObject("ultraListBar1");
var group = FindGroupByName(ultraListBar, groupName);
if (null == group) {
Log.Error("Group was not found");
return;
}
var item = FindItemByName(group, itemName);
if (item == null) {
Log.Error("Item was not found");
return;
}
// Click the item
group.Selected = true;
item.EnsureVisible();
var groupRect = group.UIElement.ClipRect;
var itemRect = item.GetUIElement().Rect;
var x = groupRect.Left + itemRect.Left + itemRect.Width / 2;
var y = groupRect.Top + itemRect.Top + itemRect.Height / 2;
ultraListBar.Click(x, y);
}
function FindGroupByName(ultraListBar, groupName)
{
var i;
for(i = 0; i < ultraListBar.Groups.Count; i++)
if (ultraListBar.Groups.Item(i).Text == groupName)
return ultraListBar.Groups.Item(i);
return null;
}
function FindItemByName(group, itemName)
{
var i;
for(i = 0; i < group.Items.Count; i++)
if (group.Items.Item(i).Text == itemName)
return group.Items.Item(i);
return null;
}
David
Related Content
- 6 years ago
Recent Discussions
- 5 hours ago