On Mon, Oct 24, 2011 at 8:16 PM, Bob Sneidar <b...@twft.com> wrote: > I am a little bit fuzzy as to why you cannot use the dgindex without the > math? Why get the dgIndexes and subtract 1 from the offset? It seems the only > reason your code works is by happy chance. It "just so happens" that > subtracting 1 from the offset gives you the correct index number in this > specific example. Or am I missing something? > > The only real reason to work with dgLine is to process through each line of > the DISPLAYED data before moving on. Scrolling will still produce dgline 1-x, > x = the number of visible lines. Once you sort, dgLine values get reassigned, > but dgIndex is preserved. For an absolute reference to a specific row, > dgIndex should be used exclusively, as every row has an index assigned, even > those not not having been displayed yet. (Right?) The only thing altering the > indexes is populating or repopulating the datagrid using dgText or dgData. > > At least this is my understanding of how it works.
dgIndex is the array index of the column data or key data dgLine is the number of the row displayed in the datagrid dgIndexes returns indexes in order of sequencing getDataOfLine uses internally getDataOfIndex to get the data of the corresponding index in the sequence. function GetDataOfLine pLine, pKey set the wholeMatches to true return GetDataOfIndex(item pLine of sIndexSequencing, pKey) end GetDataOfLine So we are totally allowed to get the data of the line - 1 by using: put GetDataOfLine(the dgLine of me - 1, "MyKey") into tDataOfPreviousLine Internally, the correct index will be used and will return the right data for the right array key. Now using something such as: put GetDataOfLine(the dgIndex of me , "MyKey") into tDataOfPreviousLine or put GetDataOfIndex(the dgLine of me , "MyKey") into tDataOfPreviousIndex are heresy and will return the right value by unhappy chance. Best regards, -- -Zryip TheSlug- wish you the best! 8) http://www.aslugontheroad.com _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode