I am facing a design decision which was already resolved long ago for our Midas Rich Text LSX, but I have to decide whether we should make the same decision for OpenSesame. Let's take the example of a chunk in Midas defined as "Table 1".
Set rtchunk = rtitem.DefineChunk("Table 1")
Now, let's and read and write the FontColor property. As described in the Help link provided: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. |
and wrote
Print "The font color is "+rtchunk.FontColor
we would read the result
The font color is Blue
but if we added
rtchunk.FontColor = Red
and saved, the result would be
The big brown | fox jumped over |
the small green | hedge. |
It should be noted that this general rule applies to attributes of things, such as size, color, etc., but content either follows the example of the Text property, where only the first content is set to the value and all others are blanked out, or it follows the example of the SectionTitle property, where each section title is replaced. Unfortunately, it is hard to tell which should be which, and when writing it, I simply used my judgement to determine what people were likely to want to do, and what would leave oddities (such as blank section titles).
So, after that long winded explanation, do I follow the same general rules for OpenSesame? Does the concept still hold because it is still essentially rich content, or is there a better way? There is always a different way, such as having a separate property which determines whether the first or all should be overwritten, but I picture that as very confusing for users, or we could go with methods instead of properties to set values, but that might also be confusing. Any thoughts?
Copyright © 2007 Genii Software Ltd.