Forum Discussion

sastowe's avatar
sastowe
Super Contributor
14 years ago

click working in one grid but not another

I have a procedure below. I use to click on the desired cell in a Janus GridEX (ActiveX version in VB6). The procedure takes a tShift contant and gives that to the click.



I have a form that has a bunch of grids on it. This code works great on one of the grids. But another of the grids of the exact same type, it will do the click but does not seem to use the tShift parameter of the click. I can see in the debugger that the skCtrl value is the same as the tShift value I am using.



I have another procedure that calls this procedure in succession which simulates a sequence of clicks with and without keys pressed. It works great for one of my grids, but not another of the same type on the same form. Any ideas what might be going on?



Thanks





Sub ClickCellEx(grid, rowIndex, sColCaption, tShift)



  Dim SplitNo, SplitCount



' Checks whether the grid contains the specified row

  If rowIndex < 1 Or rowIndex > grid.RowCount Then

    Log.Error "Row index " & rowIndex & " is out of bounds 1 ... " & grid.RowCount & "."

    Exit Sub

  End If



  ' Checks whether the grid contains the specified column

  'If Not aqObject.GetVarType(column) = 8 Then

  If Not aqObject.GetVarType(column) = varOleStr Then

    If column < 0 Or column > grid.Columns.Count Then

      Log.Error "Column index " & column & " is out of bounds 1 ... " & grid.Columns.Count & "."

      Exit Sub

   End If

  Else

    Err.Clear

    On Error Resume Next

      Set col = grid.Columns(column)

    If Err.Number <> 0 Then

      Log.Error Err.Description

      Exit Sub

    End If  

    

  End If



 

  lColIndex = getColByIndex(grid, sColCaption)

 

  ' Find the cell left and cell top, abnd cell height

  grid.Row = rowIndex

  grid.Col = lColIndex

  lLeft = grid.CellLeft()

  lTop = grid.CellTop()

  lHeight = grid.CellHeight()

    

 

  ' Calculates the horizontal coordinates of the cell (in VB twips)

  'xTwips = grid.Columns(column).Left + (grid.Columns(column).Width / 2)

  xTwips = lLeft+ (grid.Columns(lColIndex).Width / 2)

  ' Converts twips to pixels

  x = CLng(TwipsToPixelsX(xTwips))



  ' Calculates the vertical coordinates of the cell (in VB twips)

  'yTwips = grid.RowTop(rowIndexV) + grid.RowHeight / 2

  yTwips = lTop + lHeight / 2

  ' Converts twips to pixels

  y = CLng(TwipsToPixelsY(yTwips))



  ' Clicks the specified cell

  grid.Click x, y, tShift



End Sub '' ClickCellEx

4 Replies

  • sastowe's avatar
    sastowe
    Super Contributor
    It looks like for this instance, for whatever reason, the Click method is ignoring the third parameter. That is kinda troublesome. Any thoughts greatly appreciated.
  • sastowe's avatar
    sastowe
    Super Contributor
    Simple little experiment



    Sub TestMe



      set paneOne = ... intentionally obfuscated

      Set control = paneOne.VBObject("C1Elastic").VBObject("GridEX")

      ClickCellEx control, 3, "Test Status", skNoShift

      ClickCellEx control, 5, "Test Status", skShift      

     

    End Sub



    Sub TestMe2



      set paneTwp = ... intentionally obfusaced home of the different grid

      set control = control.VBObject("C1Elastic").VBObject("GridEX")

      ClickCellEx control, 3, "Result (1)", skNoShift

      ClickCellEx control, 5, "Units (2)", skShift      

     

    End Sub



    In the first example, the third param was ignored. In the second example, the third param worked.

  • Hello Stephanie,





    Since the issue is specific to one of two grids in your tested application, I would suppose that there is something specific about the problematic grid.

    Please check with your Dev Team if they can suggest some ideas. If there are no ideas, consider sending the tested application to our Support Team, so we can investigate the behavior, and try to find out where it comes from.





    As a workaround, you can simulate pressing the Shift key in a different manner:







      LLPlayer.KeyDown(VK_SHIFT, 0);





      grid.Click x, y, tShift 





      LLPlayer.KeyUp(VK_SHIFT, 0);







    You can read more about the KeyDown method in the LLPlayer.KeyDown help topic.
  • sastowe's avatar
    sastowe
    Super Contributor
    I managed to get the test implemented by clicking a different column in the desired row. I did not need THAT column, so the issue turned out to be moot. I will keep my eyes open for ideas on what might be going on going forward.



    Thanks for the help.