displaying multiline text from file

zipb's icon

What is a good method to read multiline/formatted text from a text
file and display the complete text(incl. linefeeds) in Max?
The task at hand:
User clicks a thumbnail, bigger pic appears, text with info about
this pic is read from file and displayed.
The text object just displays one line, and LCD doesn't understand CR/
LF, so you get one very long line.

Help appreciated!

Best,

Zip

Georg Hajdu's icon

Try filein and translate the ascii code into characters with itoa or
spell, and create a new line whenever you encounter ascii 13.
Max JavaScript also has file i/o capabilities which you may find
useful, but I'd start with filein.

Georg

zipb's icon

Create a newline in what object?

Best,

Zip

Jan Klug's icon

> User clicks a thumbnail, bigger pic appears, text with info about
> this pic is read from file and displayed.
> The text object just displays one line, and LCD doesn't understand
> CR/LF, so you get one very long line.

hi zip,

i don't know if you are a jitter user, but if you are, you could also
check out jit.textfile - especially if you wouldn't mind to display
the text with the use of jit.gl.text2d or so (but if you're dealing
with pictures anyway...)

jan

[ps ...so probably this reply is in the wrong forum now.?.]

John Nowak's icon

On Jan 29, 2006, at 12:54 PM, Jan Klug wrote:

> [ps ...so probably this reply is in the wrong forum now.?.]

Who cares -- The line is grey and arbitrary. I'm now subscribed to
eight lists instead of one. Just post where you please. I think most
people are on all of them anyway, which of course really defeats the
purpose... I would've drawn the line at All Things Max versus All
Things Radial.

- John

zipb's icon

Hi Jan,

Unfortunately I'm not a Jitter user yet. Budget for this job is 0, so
buying Jitter is not really an option.

Best,

Zip

Georg Hajdu's icon

Try this:
Read your text from your file using filein into a zl group which has
a sufficiently large argument so that no output is triggered
accidentally (e.g. 256).
Once you encounter character 13 in your stream of bytes, bang zl
group, prepend "write" and send its output to LCD. First move its pen
to the beginning of the line and down by an offset defined by your
font size.

Please let me know whether this has been of any help.

Georg