Forum Discussion

IuliaVascan's avatar
IuliaVascan
Occasional Contributor
3 years ago

Text Recognize of TreeList

Hello,

I am trying to get the text from a TreeList. I attached the properties of this object and the object itself. 

I need to be able to get each line of text from this object, but the Text property is empty (as can be seen in the object browser). The number of visible columns is 5, and the visible columns list has this class name: DevExpress.XtraTreeList.ViewInfo.VisibleColumnsList. I am not sure if this is the right property in order to give the text back, but I tried to call it and this error occurs "System.ArgumentException: Object of type 'System.Int32' cannot be converted to type 'DevExpress.XtraTreeList.Columns.TreeListColumn'."

 

I also found, this Text-Recognition-feature-does-not-work-for-NET-WinFormsObject. And it seems that is a possibility to make TestComplete recognize the control as a tree view, but it's not explain how.  If anyone could have a idea about this DevExpress and how could gave the text back, or if it's another property/method that I should try?

 

Thank you!

  • Hi IuliaVascan,

     

    You might need to get a specific column, by index, to get it's property or method that contains or returns the text. 

     

    Referring to you sceenshot, see my images below. Click the Params button. Place an integer in the index field. Then click OK.  You can then click the three-dot button to open the column object where you will see the properties and method for the specified column. Hopefully, one or more will return the desired text.

     

    Once you determine the desired property or method that returns the text, you could create a function like this:


    function getColumnText(columnIndex)
    {

        var columnList = DevExpress.XtraTreeList.ViewInfo.VisibleColumnsList;
        // replace DesiredPropertyOrMethod with your column's property

        // or method that returns the text
        return columnList .Item(columnIndex).DesiredPropertyOrMethod;
    }

     

    You could also walk/loop all of the columns with a function like this:

     

    function loopColumns()
    {
         var columnsList = DevExpress.XtraTreeList.ViewInfo.VisibleColumnsList;
         for (var i = 0; i < columnsList.Count; i++)
         {
            var column = columnList.Item(i);
            // what ever desired property you want to fetch
            var propValue = column.DesiredProperty;
            // what ever desired method you want to invoke

            // if it has a return value then you can set it to a  variable
            var methodValue = column.DesiredMethod(); //
        }

    }

     

     

    I hope this helps.

    • IuliaVascan's avatar
      IuliaVascan
      Occasional Contributor

      Hi again,

      Thank you for your help.

      I was trying almost all the properties and methods, but I didn't find the items text, just the name of the columns..  Name, Tx Node and so on.. I was going through the TreeList Item.. and all I got is just the Name of column

    • IuliaVascan's avatar
      IuliaVascan
      Occasional Contributor

      Hi Alex,

      Thank you for you help.

       

      Yes I had a look on this page, I've run all the properties and Methods, but for all the Text Property or Visible Colum, or anything that should bring back the text it is displaying an empty result.

       

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hm...

        Can you talk to developers and ask them whether this is standard control provided by DevExpress or some in-house customization?

        In the latter case it is possible that developers missed something and this prevents you from getting data out of control.

        If the control is native to DevExpress you may consider to create a Support case via the https://support.smartbear.com/testcomplete/message/ form.