Forum Discussion

stega's avatar
stega
Contributor
12 years ago

Get object properties

If i have a drop-down list, how can i get the items properties with the down key. I mean when i open the list and press down keyboard button can i somehow get the properties of the selected object, and if it matches with a value click on it?

Thanks.
  • Hi Gabor



    You may use drop-down list method like ClickItem(value)to select the desired value in drop-down list  without comparing its properties. if dropdown has the value it will clicked.



    Regards

    Mughees Siddiqui.
  • c_gamache_steph's avatar
    c_gamache_steph
    Occasional Contributor
    If you need to press the down arrow key and your list items have the "Keys" method, you can just code the following in vbscript inside a loop:



    listObj.Keys("[Down]")



    (You can search the TestComplete help file for "Keys Method" for more information.)



    Then, you can compare the list item's appropriate property value to the given value. Note that which properties are availabe depends on how TestComplete sees the object (which may be affected by which Open Application properties are set and the priority of them within TC's Project/Properties configuration).  



    One example I have is how I accessed a FarPoint spread control's cell values in a list and compared them with a value in a search variable, which is:



    if obj.cells.get_item(rowIdx,colIdx).TextOleValue = searchValue then...



    Hope this helps...
  • Hi All,

    Thanks for te replies.



    Mughees Siddiqui: Your solution didn't worked for me. It can be, i'm doing something wrong, but i didn't managed to get the desired list item.



    Stephen Gamache: I'm doing my script in jscript, so i have to somehow convert your example. But i'm not completely sure that i understand the example. Which part of the example gets the object property where i'm standing. If i'm using the down key, how can i get the object properties without using Find method.