Hi
Do you know what type of control it is, i.e. is it a third part control, like DevXpress? testComplete has support for such third party controls, but it depends on teh specific control and its version.
If it's supported, there is usually a 'ClickItem' method that you can use - you shouldn't need to specifically scroll the dropdown list to make the item visible. If it's not supported then you'll have to use the native properties and methods that are available to you. Sorry I can't be more specific, but without the name of the control, it's difficult!! However, should you need to specifically scroll an item into view, there is usually a 'ScrollIntoView' method available. Again, this depends on the type of control and whether it's supported.
If it's of any help (it should at least give you an idea), I've provided an example below:
/**
* S E T L O O K U P E D I T
* Public function to select an item from a Dev.X 'LookUpEdit' type combo box
* control.
*
* @param lookUpEditCtrl The LookUpEdit control object.
* @param item A string value to select an item by name or a numeric value
* to select an item by its index.
*
* @return If 'item' is a string value, the function returns True if the item is found, otherwise
* it leaves the control with its last selection and returns False.
* If 'item' is a numeric value, i.e. an index, then the function returns an array
* where element (0) is True and element (1) is the selected index's text if the item
* was found, otherwise element (0) is False and element (1) is set to an empty string.
*/
function setLookUpEdit(lookUpEditCtrl, item)
{
var result;
if (isNaN(item)) //item is a text value
{
item = item.toString();
var i = lookUpEditCtrl.FindItem_2(item, false, 0);
if (i >= 0) //item found
{
lookUpEditCtrl.setFocus();
lookUpEditCtrl.set_ItemIndex(i);
result = true;
}
else
{
result = false;
}
}
else //item is a numeric value
{
result = [];
if (item >= 0 && item < lookUpEditCtrl.wItemCount)
{
lookUpEditCtrl.clickItem(item);
result[0] = true;
result[1] = lookUpEditCtrl.Text;
}
else
{
result[0] = false;
result[1] = "";
}
}
return result;
}
This example is for a DevXpress LookUpEdit control that I use specifically for my needs, feel free to use it/modify it, but please understand that I cannot be held responsible for anything that goes wrong with it - It's an example only!!
Regards
Stephen.