Forum Discussion

sudhir_optima's avatar
sudhir_optima
Contributor
13 years ago

Unable to Right click on a grid.

In Our application we have to right click a Grid header column. We want to write a function in which we have to just pass the column name of the grid.

We can have several grid, but we want to right click on only Active grid. Please find the attachment which display both Active and Incative grid.

( By just clicking on the grid view, it get Active)



Here in screen shot 'Customer name' is Inactive while 'product' is Active. There is one uniuq property which we found and that is 'Bcckcolor' but which is itself a Object.

Using object.Backcolor.color   we get different value for both Active and Incative grid. We want to pass this value.hile creating a function , where we are using Find method and passing the Unique property,



So how to pass this Backcolor.color property in find method ?
  • This is something related to dynamic object name. I have captured all the objects names for different grid view in my application.



    See their Name , 



    Sys.Process("QBIS").WinFormsObject("MainMirandaConsole").WinFormsObject("MdiClient", "").WinFormsObject("Workbook1.qbis").WinFormsObject("xTabProject").WinFormsObject("XtraTabPage", "Dimensional View").WinFormsObject("DimensionalBrowserUC").WinFormsObject("xtraScrollableControl").WinFormsObject("QuestPanel", "", 3).WinFormsObject("DimensionTableNewUC").WinFormsObject("gridControl")


     Sys.Process("QBIS").WinFormsObject("MainMirandaConsole").WinFormsObject("MdiClient", "").WinFormsObject("Workbook1.qbis").WinFormsObject("xTabProject").WinFormsObject("XtraTabPage", "Dimensional View").WinFormsObject("DimensionalBrowserUC").WinFormsObject("xtraScrollableControl").WinFormsObject("QuestPanel", "", 4).WinFormsObject("DimensionTableNewUC").WinFormsObject("gridControl")



    Sys.Process("QBIS").WinFormsObject("MainMirandaConsole").WinFormsObject("MdiClient", "").WinFormsObject("Workbook1.qbis").WinFormsObject("xTabProject").WinFormsObject("XtraTabPage", "Dimensional View").WinFormsObject("DimensionalBrowserUC").WinFormsObject("xtraScrollableControl").WinFormsObject("QuestPanel", "", 1).WinFormsObject("DimensionTableNewUC").WinFormsObject("gridControl")



    For different grid  [WinFormsObject("QuestPanel", "", 1) ] this is changing. And we have written following function in which we are pasing the Column Name, Row no of the item on which we want to right click and the item no of of the menu .



    function DimViewGridRowPopMenu1(row,columnName,popMenuPath)

    {

      Aliases.QBIS.MainMirandaConsole.Activate();

      var PropNames, PropValues;

      PropNames = new Array("Name");

      PropValues = new Array("WinFormsObject(\"QuestPanel_", "", "\*")

      var obj = Aliases.QBIS.MainMirandaConsole.MdiClient.Find(PropNames, PropValues, 1000, true);

         var grid = obj.WinFormsObject("gridControl");

      grid.ClickCellRXY(row,columnName,10,10,0);

      grid.StripPopupMenu.Click(popMenuPath);

    }



    But it still failed to identify the object 'obj' can any one help me ?


  • Hi Sudhir,





    First of all, I'd like to note that you need to look for the grid control itself, not for its container panel, because it's the grid which has unique criteria. The problematic container whose property values vary will be simply ignored in this case. Secondly, you can retrieve all objects which match the grid recognition criteria (e.g. it's native name and ClrFullClassName) via FindAll/FindAllChildren and then enumerate the retrieved objects and run any custom validation routines for each of the objects to check whether that's an object you need.