How Do I Scroll a Row To The Top of the Data Grid Form?
This lesson will show you how to scroll a particular row to the top of the Data Grid form using the dgRectOfIndex (or dgRectOfLine) property. This technique is useful when your rows are not a fixed height.
Here you can see that I have a selected row in a data grid (1). I want to scroll that row to the top of the data grid (2).
How To Do It
Here is the code that will scroll the selected line to the top of the data grid:
put the dgHilitedIndex of group "DataGrid" into theIndex put the dgRectOfIndex [theIndex] of group "DataGrid" into theControlRect put the rect of group "DataGrid" into theGridRect put item 2 of theGridRect - item 2 of theControlRect into theOffset set the dgVScroll of group "DataGrid" to the dgVScroll of group "DataGrid" - theOffset
After executing the code the row will be a moved to the top of the data grid.