In trying to figure out how to generate a reference page for
LzTextFormat, I believe I've stumbled upon an implementation problem
that bears upon the "dual api" discussion.
LzTextFormat (components/extensions/views/LzTextFormat.lzx) is written
as an LZX library:
<class name="LzTextFormat" extends="node">
Thus it is legal to have a <LzTextFormat> tag in an lzx program.
However, it is intended to be used solely from script, as a way to pass
parameters to the setTextFormat() method on <richinputtext>, as shown
in this example:
<richinputtext name="rich" width="300" height="100"
multiline="true"
text="Use setTextFormat to set several formatting attributes
at once." >
</richinputtext>
<button onclick="parent.bigAndSans()" >
make it huge and futura
</button>
<method name="bigAndSans">
var tf = new LzTextFormat();
tf.font = "Futura";
tf.size = 32;
rich.setTextFormat(tf, 0, 300);
</method>
Ben Shine, who created LzTextFormat, confirms that having a
<LzTextFormat> tag is not desired or meaningful; you're only supposed
to use the script interface, that is:
var tf = new LzTextFormat();
However, since the class is created with a <class> tag, we get the
<LzTextFormat> tag whether we like it or not, and furthermore, there's
no easy way to tell the documentation tools to only document the script
interface.
OpenLazlo Runtime classes (also known as LFC, Laszlo Foundation
Classes) are usually written as .as files, not .lzx, and so this
problem is kind of unique.
I can finesse the documentation problem with a hack--by hand-generating
an XML file of the right format and swapping it for the automatically
generated one. This is a kludge, of course, since the tag will still
be there -- but at least it won't be documented.
Questions:
1) Should LzTextFormat be rewritten as a .as file? That would make the
documentation tools "just work" and get rid of the unwanted
<LzTextFormat> tag.
2) Or, for the short term, should I just do the doc hack?
3) Architecturally speaking, what's the right solution? Was Ben
"wrong" to implement this as an LZX file? Or should there be some kind
of semantics defined such that you can define a class with the <class>
tag and indicated that it's only for script use?
Thanks
jrs
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev