Datagrid: multiple hilites
David Bovill
david at architex.tv
Fri Oct 16 18:58:59 EDT 2009
I've upgraded to the latest datagrid - fixes the add to end issue reported
earlier. So naturally that's led to another one :)
I want to allow the user to quickly select multiple lines of a form by
clicking on them - with "auto select" unless you hold down the command key.
I scripted a way to do that using the dgHilitedIndex:
command tweet_ToggleHilite
> put the dgControl of me into dataGrid
> if the dgProp ["auto hilite"] of dataGrid is false then
> put the dgLine of me into myIndexNum
> put the dgHilitedIndex of dataGrid into indexNums
> set the wholematches to true
> put itemOffset (myIndexNum, indexNums) into foundItem
> if foundItem = 0 then
> if indexNums is empty then
> put myIndexNum into indexNums
> else
> put comma & myIndexNum after indexNums
> end if
> else -- already hilited
> delete item foundItem of indexNums
> end if
> sort numeric items of indexNums
>
> lock screen
> put the dgControl of me into dataGrid
> put the dgVScroll of dataGrid into someScroll
> set the dgHilitedindex of dataGrid to indexNums
> put indexNums
> set the dgVScroll of dataGrid to someScroll
> unlock screen
> end if
> end tweet_ToggleHilite
>
However this script only works until, I start adding lines using "AddData".
Maybe there is a better way?
More information about the use-livecode
mailing list