Datagrid SelectionChanged issues

David Bovill david.bovill at
Thu Aug 27 10:26:48 EDT 2009

2009/8/27 Trevor DeVore <lists at>

> dgHilite isn't a data grid property. It is a property of a row control.
> Template Custom Properties & Messages:
> <
> >
> If you are trying to change the selection you should be setting the
> dgHilitedIndex or dgHilitedLine of the data grid.

Sorry a typo - the card script does set the dghilitedLine:

   dispatch "FindLine" to dgView with "title", viewName
>    put the result into vLineNum
>    set the dgHilitedLine of dgView to vLineNum

What i am finding is that when I issue this from the card script a
"selectionChanged message is sent - but with an empty pHilitedIndex.
Therefore this script:

on selectionChanged pHilitedIndex, pPrevHilitedIndex
>    if pHilitedIndex is empty then
>       answer "Selection changed using dgHilitedLine!"
>       put the dgHilitedLine of grp "View Grid" into vLineNum
>       answer (vLineNum && "is the old dgHilitedLine. How do i get the new
> one?")
>    else
>       answer "Selection changed by clicking on a dgDataControl!"
>       put the dgHilitedLine of grp "View Grid" into vLineNum
>       answer ("Great" && vLineNum && "is the new dgHilitedLine.")
>    end if
>    if pPrevHilitedIndex is empty then
>       answer "pPrevHilitedIndex is empty!"
>    else
>       put pPrevHilitedIndex
>    end if
> end selectionChanged

Shows that when using  "set the dgHilitedLine" both params to
"selectionChanged" are empty, and "the dgHilitedLine" is set inconsistently?

More information about the Use-livecode mailing list