We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to make a simple scrollable text box and can only find a few rather complex examples, that tbh I'm finding hard to understand and don't want to use off the shelf GUI libraries.
The textBox will be used to display simple short&fixed size messages, being fixed max length I do not need wrapping, can just make sure the width of textbox and the textsize are set to fit max message length. Every new message will be on a new line and once there are more lines than the height of the box will allow, the lines should all move up and make room for the next incoming message below.
I need to be able to scroll back up the list of messages in order to check back on messages....the hard part I think.
Have looked at StringList which looks best to store(append) the incoming messages and be able to clear them all when I need to.
I'm totally lost with where to start on the scrolling though, can anyone point me in the right direction ?
Answers
Try this post: https://forum.processing.org/two/discussion/20277/scrollable-text
Kf
Thanks @kfrajer, that's one of the examples I found and was struggling with, though to be fair I had jumped straight to the full class example rather than the basic first one... having gone back and looked again I have hacked something together and am now looking at the HammerTime example to try and figure calculating line height..as it goes at the moment, I can't touch this ;)
@mala -- the block of code that you want from the HammerTime sketch ( https://www.openprocessing.org/sketch/96700 ) is
class Tex
-- which is a "class for getting text height".Paste the Tex class code into your sketch, then create a Tex and check
.totalHeight
or.getHeight()
, like this:Now the scrolling....
@jeremydouglass thanks, yeah that is kinda of what I looked at, here's what I came up with by mixing it altogether:
Great, thxs for sharing your implementation.
Kf