displaying multiline text from file

Jan 29, 2006 at 4:59pm

displaying multiline text from file

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

#24171
Jan 29, 2006 at 5:19pm

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

#69500
Jan 29, 2006 at 5:42pm

Create a newline in what object?

Best,

Zip

#69501
Jan 29, 2006 at 5:54pm

> 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.?.]

#69502
Jan 29, 2006 at 6:28pm

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

#69503
Jan 29, 2006 at 6:29pm

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

#69504
Jan 29, 2006 at 11:02pm

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

#69505

You must be logged in to reply to this topic.