We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More

Forum Discussion

swapnalinarkar's avatar
swapnalinarkar
Occasional Contributor
11 years ago
Solved

Unable to recognize child objects of Java SWT Application

Hi, I am using testcomplete tool for dsktop application. GUI of the application is built in JAVA (SWT). I am facing an issue that 'Child objects of application are not able to recognize using Obj...
  • HKosova's avatar
    HKosova
    11 years ago

    It seems to be a https://eclipse.org/nebula/widgets/grid/grid.php control. If so, you can get data from this grid and interact with it using the grid's internal methods and properties - those under the Java category in the Object Browser.

    For example, to get the grid data:

     

    // JScript
    var grid = ...; // "path" to your grid object
    
    var nRows = grid.getItemCount();
    var nCols = grid.getColumnCount();
    
    var value;
    for (var i = 0; i < nRows; i++)
    {
      Log.Message("Row " + i);
      for (var j = 0; j < nCols; j++)
      {
        value = grid.getItem(i).getText_2(j).OleValue;
        Log.Message(value);
      }
    }

     

    To expand or collapse a row:

     

    gridObj.getItem(index).setExpanded(true);
    
    gridObj.getItem(index).setExpanded(false);