Monday, August 17, 2009

QTP and SyncFusion Grid controls

Syncfusion grid control is a custom .net control. We can use various methods with syncfusion control to work on the grid from QTP.
e.g Grid.Object. [methods]
the methods can be pulled out from the class library located at
http://www.syncfusion.com/.
however to perform different keyboard operations like dbl click we need to use the below code.

Public function GridCellDBClick(row,col,Grid)
set objGrid = Grid.Object
If objGrid.RowCount <>
GridCellDBClick = False
End If
'get the cell in view by scrolling the view
objGrid.ScrollCellInView3 row,col,"dbclick"
'clear the selections
objGrid.Selections.clear
objGrid.SelectRow row
'get the current selected cell object
Set objcurrentcell= Grid.Object.CurrentCell
' move the selection to current cell

objcurrentcell.MoveTo row,col
objcurrentcell.ScrollInView
'get the coordinates of the cell
set rect = objGrid.RangeInfoToRectangle(objcurrentcell.rangeinfo)
'double click on the cell Grid.DblClick rect.X + rect.Width/2, rect.Y + rect.Height/2
End function