I have a group simulating a popover that I wish to appear on double-clicking a row in a data grid form.
The idea is to line up the middle of the popover group with the middle of the selected row like so:
I initially pleased to find the lesson How Do I Scroll a Row To The Top of the Data Grid Form?, which suggests you can use
Code: Select all
the dgRectOfIndex [theIndex] of group "DataGrid"
Does this exist/is it deprecated or am missing something supremely obvious?
As an alternative i've come up with some highly suspicious math that doesn't fully work. It initially seemed to line up the popover perfectly, but when scrolling past 5 rows (so that the top visible row is row 5 or higher).the popover gets placed adjacent the next row down, so i'm clearly doing doing something wrong... :-/
Code: Select all
put the dgHilitedLines of group "data grid" into tRow
put item 1 of the dgVisibleLines of group "data grid" into tVisRows
put the dgProps["row height"] of group "data grid" into tRowHeight
put the top of group "data grid" into tTableTop
put (the height of group "popover")/2 into tOffset
put tTableTop + (tRow - tVisRows) * tRowHeight + tRowHeight/2 - tOffset into tTop
set the top of group "popover" to tTop
set the right of group "popover" to the left of group "data grid"
If dgRectOfIndex does actually exist that would simplify the above to a couple of lines...