textedit alternative for scrolling feed?

Eddie's icon

Hi!
I'm trying to implement a simple chat like feature in my patch, and am having a hard time (coming from a web/C# background) getting the textedit object to behave how I'd like:

- Add an incoming string to the bottom (or top) of the textedit feed. Got this. No problem.
- Add the incoming string (i.e., symbol?) without enclosing "double quotes". I'm having a hard time with this one, since [append $1] seems to be the one adding the " ", and altering anything after the append seems to break the input into textedit... I've tried regexp and sprintf, but the append $1 of a symbol seems to insist on the quotes.
- Scroll? I know there's an autoscroll feature, but it's not the way I'd expect from a feed based text box. The user has to click in the textedit object and scroll manually with the arrow keys. Is there a slicker alternative?

I could always just stick the feed in the Max Console, but I'm trying to make something as self-contained as possible, since the target users are going to be middle/high school students. Are there solutions to this with textedit, or another ui object floating around that I could plugin?

Thanks for the expertise, folks!

Len Richardson's icon

Hi Eddie,

did you take a look at jit.cellblock yet? It is far more limited than the Max console but at least you can make it get to work like an auto-scrolling feed. Another solution i could imagine is to work with js in a bpatcher to create message boxes and scroll to the bottom using the bpatchers y-offset.

11OLSEN's icon

I'm a fan of jit.cellblock. Somehow you can always bend it to do what you want. I remember a scrolling textarea thread here. Combined with a jsui you can even set font style and text-wrapping. Looking for the thread... https://cycling74.com/forums/textarea-object. Note: the code for the jsui is in a patcher, you need to save it as a file first

Len Richardson's icon

I was a little curious about it. jit.cellblock seems to be more slick than I expected. Here is a little attempt:

Max Patch
Copy patch and select New From Clipboard in Max.

Eddie's icon

Thanks, Len and 11Olsen! I think eventually, once I get the actual structure of the patch complete, I'll go the jit.cellblock route. It looks like the most powerful and flexible option.

There's so much I need to get into. jit, gen, etc... After coding in the C++/C# world for so long, I feel like I'm learning a remote dialect... a very cool and hipster dialect, but remote!

tmhglnd's icon

You could also use jit.gl.text and embed the view in the patcher by rendering the context to a jit.pwindow. Then you can use jit.matrix to add/remove text, use jit.concat to add extra lines, or even work in javascript. As an example, i made this texteditor for jitter you can have a look at: https://github.com/tmhglnd/th.gl.texteditor