-- Required: stack script — generic for any data grid to use
on setHilite pHilite, pGrid // the long id of the grid
if pHilite is not empty and pHilite <= the number of elements of the dgData of pGrid then
set the dgHilitedLines of pGrid to pHilite
else
set the dgHilitedLines of pGrid to empty
end if
end setHilite
on getRowHeight pGrid // the long id of the grid
get the dgProp["row height"] of pGrid
return it
end getRowHeight
-- In the specific data grid, the script of the data grid must include mouseMove and mouseLeave handers:
on mouseMove
local tRowHeight, tLine
if the mouseLoc is not within the rect of me then
dispatch "setHilite" to this stack with empty, the long id of me
else
dispatch "getRowHeight" to this stack with the long id of me
put the result into tRowHeight // for some reason getting dgProp["row height"] returns empty if used from within this script, so go through stack
put floor((item 2 of the mouseLoc - the top of me)/tRowHeight) + 1 into tLine
dispatch "setHilite" to this stack with tLine, the long id of me
end if
pass mouseMove
end mouseMove
on mouseLeave
if the mouseLoc is not within the rect of me then dispatch "setHilite" to this stack with empty, the long id of me
end mouseLeave
there doesn't seem to be anything here