Genii Weblog
OpenSesame: Reading/writing properties across multiple entities
Wed 9 May 2007, 11:03 AM
Tweetby Ben Langhinrichs
When read, this is the color specified in the first text record encountered (presumably the color for this chunk). When written, this sets the color for all text records in this chunk.In other words, an attribute such as font color may apply to many elements within the defined chunk, but the general rule for attributes is that when reading those attributes, Midas will stop when it finds the first one and return the attribute for that, even if all the others are different, but when writing those attributes, Midas will apply the attribute to every element found. Thus, if we started with the following table:
The big brown | fox jumped over |
the small green | hedge. |
The big brown | fox jumped over |
the small green | hedge. |
Copyright © 2007 Genii Software Ltd.
What has been said:
589.1. Matt Vargish (05/09/2007 12:11 PM)
Its an interesting problem. If you don't overwrite the whole chunk, you make an annoyance for the user in that they have to loop through the constituent (child) chunks if they do want it all changed; it makes sense to me that the burden should fall to the user to process the child nodes individually if they need that granularity.
One thing I've thought when writing against such models is that it would be nice to have a convenience method to check on the child elements without having to execute the loop, something like:
if rtchunk.childPropertiesMatch("FontColor", rtchunck.FontColor) then
' code to change the whole block
else
' code to loop each element and make a decision
' or perhaps skip / log / recurse /etc
end if
The method could take additional parameters, for example to narrow the scope of the match (e.g. only check table cells not text fragments).
589.2. Milos Lapis (05/10/2007 06:42 AM)
I agree with Matt. I would be helpful to find out if there are differecies in attributes on the text fragments inside cells against table cells and then run a different code or apply changes to all cells in a table.