Hi Graham, Mark expalined the syntax I think. You probably already realise this, but using getProp isn't an integral part of the datagrid, I think Trevor just used it as an example.
Since you're doing a spreadsheet, I assume you'd want to multiply any 2 columns together, not specific ones. If that's the case, you could consider putting a handler in the datagrid's group script that takes the column names as parameters and returns the result. Something like: function multiplyColumns pcol1,pcol2 put the dgHilitedLine of me into tLine try put GetDataOfLine(tLine,pcol1) * GetDataOfLine(tline,pcol2) into tresult catch terr return terr end try return tresult end multiplyColumns The try is in there in case one of the columns doesn't contain numeric data or the column name doesn't exist but you could ctach that other ways. Datagrids are great but it takes a while to get to grips with them! Pete On Mon, Apr 2, 2012 at 3:13 AM, Graham Samuel <livf...@mac.com> wrote: > For the very first time in a pretty long career as a LiveCode coder, I'm > trying to make sense of DataGrids, which I see were a heroic effort to > extend LiveCode - with a very sophisticated implementation and literally > hundreds of pages of documentation. AFAIK it was done by Trevor deVore - I > am deeply impressed, even as I stumble. > > I am trying to implement some spreadsheet-like behaviour and have fallen > more or less at the first fence during the lesson on Page 94 "How do I get > Aggregate Values for Columns?". > > I can make the example work if I follow it exactly. It depends on a > getProp handler the first line of which is: > > getprop uSumOfColumn [pColumn] > > I would like to multiply two columns using this as a starting point, so I > would like to refer to two columns in my getProp handler. However when I > look up getProp in the LC documentation, I don't see that getProp can take > any parameters at all, certainly not an array reference, so my attempt to > extend this structure with a line like > > getProp usMultipleOfColumns [pColumn1] [ pColumn2] > > can't be compiled - putting a comma in between the parameters (if that's > what they are) doesn't help. As you see I have no idea what I'm doing. My > question is, how does the syntax of the original getProp handler work? How > is the bit in square brackets allowed, and why isn't it featured in the LC > documentation? If I did want to provide a getProp handler with the names of > two different columns, how would I do it? I do realise there are much more > pedestrian ways of achieving what I want, but it seems important to > understand the mechanism shown in the DataGrid docs. > > Ignorantly > > Graham > > _______________________________________________ > 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 > > -- Pete Molly's Revenge <http://www.mollysrevenge.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