PDA

View Full Version : preformatted text in dhtml


clhona
07-23-2010, 06:03 AM
Hi, how can I use preformatted text in dhtml?

the example on the site didnt work in dhtml:


<canvas height="80" width="100%">
<text id="ttext" multiline="true" height="300">
This text field contains some preformatted text
<pre>
This is a line of text.

here was a blank line before this line.
And another line of text.
</pre>
</text>
</canvas>



thank you

clhona

cayres
07-23-2010, 10:17 AM
Your sample seems to work with OpenLaszlo 4.8 - the line breaks and the blank line show up fine. It's not a monospace font, but you can add that if you want. Are you using an earlier version of OpenLaszlo?

clhona
07-24-2010, 05:25 AM
Hi! I use the 4.8 version.

Compiling with DHTML the result is:


This text field contains some preformatted text

This is a line of text.

here was a blank line before this line.
And another line of text.




with SWF10:

This text field contains some preformatted text

This is a line of text.

here was a blank line before this line.
And another line of text.



Is there a way to have spaces before text?

Thank you! :)

cayres
07-26-2010, 11:26 AM
Sorry, I didn't notice the indents. Don't know how to fix that - looks like it might be a 'feature' of the DHTML compiler. You may have to separate out the indented part of your text and set its 'x' position explicitly - something like:
<canvas height="400" width="100%">
<simplelayout axis="y"/>
<text id="heading">
This text field contains some preformatted text
</text>
<text id="ttext" x="30" multiline="true" height="300">
<pre>
This is a line of text.

There was a blank line before this line.
And another line of text.
</pre>
</text>
</canvas>
Sorry, I don't have a better solution.

clhona
07-26-2010, 12:12 PM
Sorry, I don't have a better solution.


Anyway...it woks!

thank you

clhona