Datagrid: multiple hilites

David Bovill david at architex.tv
Sat Oct 17 09:54:41 EDT 2009


Here are some handlers that seem to work "most" of the time. Could be
improved by adding shortcut for fixed height rows, and it seems like the
geometry gets a little messed up in some circumstances (maybe when adding
rows using AddData?) - but it is a start, perhaps the beginning of a feature
request?

command dg_ScrollToIndexTop pIndexNum, pAnimate
>    put the dgControl of the target into dataGrid
>    if exists(dataGrid) is false then return empty
>    put the dg_IndexScrollTop [pIndexNum] of the target into recordTop
>    if recordTop is a number then
>       if pAnimate is true then
>          dispatch "StartScrollAnimation" to dataGrid with recordTop
>       else
>          set the dgVScroll of dataGrid to recordTop
>       end if
>    end if
>    return recordTop
> end dg_ScrollToIndexTop
>
> getprop dg_IndexScrollTop [pIndexNum]
>    if pIndexNum = 0 then return 0
>    put the dgControl of the target into dataGrid
>    if exists(dataGrid) is false then return empty
>    if the dgprop ["cache controls"] of dataGrid is false then return empty
>
>    put 0 into recordTop
>    repeat with someNum = 1 to pIndexNum
>       put the dgRectOfIndex [someNum] of dataGrid into rectOfIndex
>       put item 4 of rectOfIndex - item 2 of rectOfIndex into recordHeight
>       add recordHeight to recordTop
>    end repeat
>    subtract 3 from recordTop -- just a tweek to show a margin
>    return recordTop
> end dg_IndexScrollTop
>



More information about the use-livecode mailing list