Forum Discussion

mmkumaram's avatar
mmkumaram
Occasional Contributor
13 years ago

Syncfusion GridTableControl support

Hi,



In our application we have a syncfusion table with clrClassName Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl and i am having trouble in selecting rows,clicking a particular cell etc. Basically i am not able to see methods like ClickCell,ClickRowIndicator 



Any idea why I am not able to use these methods?.. i believe TestComplete supports Syncfusion controls.



I am using TestComplete 8.5



Thanks,

Muthu


8 Replies

  • Hi,


    Here are the requirements that should be met in order for TestComplete to be able to work with this control:


    1. Make sure this plug-in is installed and enabled in TestComplete.

    2. The control’s class name must be specified in the Syncfusion Controls | Grid grouping | Table grouping group of your project’s Object Mapping options.


    If you still face the problem, please specify the version of the control you are using.

  • mmkumaram's avatar
    mmkumaram
    Occasional Contributor
    Thanks for your reply.



    The Plug-in is installed and I have the correct object name mapping in my projects. (ref attached screenshot), but still i am not able to see the methods (clickCell methods ref:http://smartbear.com/support/viewarticle/11554/) for Syncfusion.Windows.Forms.Grid.Grouping.GridTableControl



    I made little progress by using Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl



    The table has a parent object with ClrClassName = "Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl" on this object and I am able to the use ClickCell Method on the table that I am looking for. But ClickCell methods works only on the table data and not for Filter row, . Is there any other mehtods that could be used for filtering the values?.(ref attached table screenshot which has filter row).



    when I use WinFormsObject("grid_common_").ClickCell(0,"Category");, it clicks on first row cell of Category column and not filter cell.



    Syncfusion version is : 8.3.0.21





    Thanks,

    Muthu






  • Hi,




    The table has a parent object with ClrClassName = "Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl" on this object and I am able to the use ClickCell Method on the table that I am looking for.


    The object with the Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl class name is a test wrapper for your table. You are right to use the members of this object to work with the table.




    But ClickCell methods works only on the table data and not for Filter row, . Is there any other mehtods that could be used for filtering the values?


    It looks like the filter arrow is not a part of the cell itself, it is an individual object. So, when you call the table's ClickCell method, it simulates a click on the specified cell, but does not click the filter element. Thus, the table's ClickCell method could not be used for filtering the values. As a workaround, you can simulate clicks on filter elements by using ordinary coordinate clicks. See the description of the Click action.

  • mmkumaram's avatar
    mmkumaram
    Occasional Contributor
    Ok, I shall use GridGroupingControl object to work with the table. All additional TestComplete methods(ClickCell,ClickColumnHeader,ClickRowIndicator) are really useful. 



    Regarding the filter row, I don't think so I can use Click method as I don't see the Filters cells as separate object. It seems to be part of the table. Spying WinFormsObject("grid_common_").Table.TableModel.Item(2, 1).CellType give the cell type as FilterBarCell, not sure why this row is not accessible on CellClick method. CellClick(0,0) actually represents the first cell next to filter row, but not the filter cell.(ref attached clickCell attachment).



    I am able to add the filter to table by directly calling the .Net Assembly method(Thanks to TestComplete for providing this feature), i.e WinFormsObject("grid_common_").TableDescriptor.RecordFilters.Add(Sys.Process("Petrel").AppDomain("petrel.exe").dotNET.Syncfusion_Grouping.RecordFilterDescriptor.zctor_6("WellName",Sys.Process("Petrel").AppDomain("petrel.exe").dotNET.Syncfusion_Grouping.FilterCondition.zctor_2(Sys.Process("Petrel").AppDomain("petrel.exe").dotNET.Syncfusion_Grouping.FilterCompareOperator.Equals_2,"INJ1"))).



    With this I could simulate the filter actions, but it would be good if we could simulate how the users would be doing, i,e clicking Filter cell and selecting the value from drop down.



    Thanks,

    Muthu





     
  • Hi,


    Try using TestComplete's recording functionality to record clicking the filter cell and selecting the needed value. Just simulate user actions over the Filter cell, TestComplete will record them to the test. Then, you can explore how TestComplete recognized these actions and use the recorded test to simulate the filter actions.

  • mmkumaram's avatar
    mmkumaram
    Occasional Contributor

    Thanks for the reply.



    I tried recording the actions in TestComplete and I got the below script.  When I click on Filter cell it generates "gridTableControl.Click(82, 56) ", as you said in previous posts it recorded using the co-ordinates. I am bit sceptical while using co-ordinates in my script. The Dialog which I use is not always constant, the screen size changes if the data is grouped and i guess this might affect the script. Also, We run our scripts in different platform, based on my experience the screen size tend to differ on machines and script fails to click on required object that we are looking for, so we avoid using Co-ordinates in our script. 



      var petrel;

      var uiTabs;

      var gridTableControl;

      petrel = Sys.Process("Petrel");

      uiTabs = petrel.CompletionsSpreadsheets_Design.WinFormsObject("tabs_");

      gridTableControl = uiTabs.WinFormsObject("UiTabPage", "Completions").CompletionsSpreadsheet_Design.WinFormsObject("Panel", "", 2).splitContainer1.WinFormsObject("SplitterPanel", "", 1).grid_common_.WinFormsObject("gridTablePanel").tableControl1;

      gridTableControl.HScroll.Pos = 18;

      gridTableControl.VScroll.Pos = 65;

      uiTabs.ClickTab("Completions");

      gridTableControl.Click(82, 56);

      petrel.WinFormsObject("PopupHost", "").WinFormsObject("GridDropDownContainer", "").WinFormsObject("GridComboBoxListBoxPart", "").ClickItem("G1B");



    Thanks,

    Muthu


  • Hi Muthu,


    To filter the values in the needed column, you can try following the steps below:


    1. Use the HoverMouseColumnHeader method to move the mouse pointer to the header of the specified grid column.

    2. Use the MouseX and MouseY properties to get the current screen-relative horizontal and vertical coordinates of the mouse cursor.

    3. Using the MouseY property, increase the vertical coordinate's value of the mouse cursor, for example by 15 pixels. This will move the mouse pointer to the filter cell that is placed under the column header.

    4. Call the Click action and use the mouse cursor's coordinates to simulate a click. For example:



    gridTableControl.Click(Sys.Desktop.MouseX, Sys.Desktop.MouseY)



    5. Use the ClickItem action of the combo box control to select the needed combo box item. You have already recorded this action, and you can use this code in your test:



    petrel.WinFormsObject("PopupHost", "").WinFormsObject("GridDropDownContainer", "").WinFormsObject("GridComboBoxListBoxPart", "").ClickItem("G1B");

  • mmkumaram's avatar
    mmkumaram
    Occasional Contributor
    Hi Margaret,



    Excellent, This solution works fine with minor tweaks. This is exactly what I was looking for, it is very close how the user would be doing. Also this reduces the co-ordinate issues when the script is executed in different machines/resolutions(unless the developer changes the position of Filter cell)



    changes:

    On Step 4. Call the Click action and use the mouse cursor's coordinates to simulate a click. For example:



    gridTableControl.Click(Sys.Desktop.MouseX, Sys.Desktop.MouseY+25)--> this didn't work, it clicks on different position. using below example seems to click on correct position.



    groupGrid.HoverMouseColumnHeader("Well name");


     var posX = Sys.Desktop.MouseX;


     var posY = Sys.Desktop.MouseY;

     posY = posY + 25;



     


    Sys.Desktop.MouseDown(1,posX,posY);



     Sys.Desktop.MouseUp(1,posX,posY);


     

    Once again thank you very much for your help.



    Regards,

    Muthu