Forums > Jitter

How to send TextEdit object content into a context.

Feb 06 2017 | 2:18 pm

It seems like something that could be easily achieved.
I would like to display the content of a TextEdit object into a context and have the exact same formatting has the text shown int the TexteEdit object window.
Basically, I want to write text in a live situation.

I was not able to achieve this with the since it does not take in consideration the line jump made by the ENTER key.
Is there an object that could do the trick?
Or does anyone has an idea of a method I could try?
Thanks a lot for your help.

— Pasted Max Patch, click to expand. —
Feb 07 2017 | 8:53 am

if you want to simply read in and display a text file, then it is quite easy to do with jit.textfile. read it in and bang it out to

if you want to display what you are typing live, then it’s much more complicated. i’ve found the best way to do this is to use jit.str.fromsymbol to convert a line of text to a 1D matrix (the dim of the matrix equals the number of characters in the line of text) . you then copy this matrix into a 2D matrix (2nd dim represents the number of lines of text), using dstdimstart / dstdimend. this requires you to know the maximum line length and maximum number of lines you will by typing.

— Pasted Max Patch, click to expand. —
Feb 07 2017 | 4:07 pm

Your method (the second one) works perfectly for my purpose Rob!
Again, thank you very much for your support.

Viewing 3 posts - 1 through 3 (of 3 total)

Forums > Jitter