uliwitness / Stacksmith

An intuitive software erector kit targeted at people new to programming, but with enough potential to stay useful once they've learned, inspired by HyperCard.
http://stacksmith.org
129 stars 13 forks source link

Support properties on chunks #9

Closed uliwitness closed 11 years ago

uliwitness commented 12 years ago

Like HyperCard's "set the textStyle of character 1 to 5 of cd fld 1 to bold".

Best approach is probably to make the optimizer notice when a property expression references a chunk (in Simplify()) and in that case make sure it's turned into a chunk reference, not a constant chunk. Furthermore, LEOValue needs to be extended to have a call that sets a property with a range, and an instruction needs to be added that calls that method. Then we close down the range (as usual with nested chunks) and then call that on the final value. Then buttons and fields need to implement their contents as object reference values (not just a string) so we can send a "change property X with range Y to value Z" method to the actual object.

Worries: What if a field or its substring contains an associative array? If that has a textStyle key? I guess we'll finally have to introduce a "contents" property, and use that to explicitly state when we want the text as text, and not an editable range of the field? A bit too techie though...