getProp syntax query

Mark Schonewille m.schonewille at economy-x-talk.com
Mon Apr 2 07:38:06 EDT 2012


Hi Graham,

The following (nonsense) example works:

getProp foo[bar]
   answer bar
   return "hello world"
end foo

setProp foo[bar] theData
   answer theData
   pass foo
end foo

You can use only one index, i.e. the setProp/getProp handlers are one-dimensional. An additional parameter contains the data that the property is being set to. Use the target to find out which control's property is being set. 

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Get the extIco2Png external for LiveCode here http://qery.us/1w6

On 2 apr 2012, at 12:13, Graham Samuel 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





More information about the use-livecode mailing list