Forum Discussion

Test56's avatar
Test56
Contributor
13 years ago

TreeView20WndClass is not supported with Tree Item text

Hello,

I am using TC 8.2 . We have an application which has implemented TreeView20WndClass . I spied it through test complete and found that "Unicode" property is true for the application. So we are able to interact with the tree items using only indexs and not the text of the each tree item.

e.g.



Test 

        Method1

        Method2 

                       Call1



If we have to interact with Call1 item , |Test|Method2|Call1 is not working but |0|1|0 is working fine. Even when i tried to go for wItem of tree with index as 0 , we do get a object but with no text . Do we have any ways through which we can interact with the individual tree item using text of the item and not just indexes (tree which has Unicode set as true).

3 Replies

  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)

    Hello Rajat,


    We failed to reproduce the behavior you describe. Could you please provide us with a bit more information about your issue so we can continue our investigation?


    1. Are you using script tests or keyword tests? Does the issue occur in both scripts and keyword tests?

    2. Can you view the tree view items’ captions via the Object Browser?

    3. Does the same issue persist with tree view items whose captions contain only Latin characters?

    4. Is the Language for non-Unicode program option of your operating system set to the same language you use in your application under test?

    5. Could you please also run the following VBScript script and let us know what it will post to the test log?



    Sub Test

      Dim TreeObj



      ' Replace this object with your Tree View control object

      Set TreeObj = Sys.Process("Project").VBObject("Form").VBObject("Tree")



      Set TreeItemsCollection = TreeObj.wItems

      ProcessItems(TreeItemsCollection)



    End Sub



    Sub ProcessItems(ACollection)

      If Not ACollection is Nothing And ACollection.Count > 0 Then



        For i = 0 To ACollection.Count - 1



          Set Item = ACollection.Item(i)

          Log.AppendFolder Item.Text



          If Not Item.Items is Nothing Then

            ProcessItems(Item.Items)

          End If



          Log.PopLogFolder

        Next



      End If



    End Sub



    Please note that you need to modify the script and assign the proper object that corresponds to your Tree View control object to the TreeObj variable.


    Thanks in advance.

  • Hello Julia,



    Thanks for your reply.

    1. Are you using script tests or keyword tests? Does the issue occur in both scripts and keyword tests?

    Ans : I am using script tests. But the issue is there for both keyword as well script test.

    2. Can you view the tree view items’ captions via the Object Browser?

    Ans : Nope i am not able to view captions via object browser. Even through object spy, neither i am able to view any caption nor i am able to view TreeObj.wItems.Item(index).Text.

    3. Does the same issue persist with tree view items whose captions contain only Latin characters?

    Ans : This i couldn't test.

    4. Is the Language for non-Unicode program option of your operating system set to the same language you use in your application under test?

    Ans : The language is set to English(United States) which is same for the application.

    5. Could you please also run the following VBScript script and let us know what it will post to the test log?

    Ans : I ran the above script but didn't get any text value returned. PFA the screen capture of the log.

     Please let me know if you need more information.

  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)

    Hello Rajat,


    Thank you for the provided information.

    Your issue seems to be caused by the fact that your tree view control is owner-drawn, not by the fact that it supports Unicode. That is, it is drawn by the application, not by the operating system, and TestComplete cannot access the text of the items' captions of the tree view control.


    Please go through the Working With Owner-Drawn Tree View Controls Help topic - it describes some specifics of working with such controls.

    For more information on possible approaches that you can use to work with owner-drawn items of the tree view control using their captions, please see the Improving Object Recognition Help topic. For example, you can use the text recognition technology.


    Please let us know if this does not help.

    Thank you.