[Request] Scrollable Text

Post your completed addons to share with the community

Post » Fri May 04, 2012 4:04 pm

Hi there,

I was wondering if anybody would be able to make a scrollable text plugin for me. I need it for a chat box in an mmorpg I'm making with Construct 2, and needed the text to be able to fill up more than it's height worth of text. Would anyone be able to make one for me?

Any help is much appreciated.

Thanks!
Dengke / ValkyrieGames
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Fri May 04, 2012 4:20 pm

what about iscroll or multiline box ?
B
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » Fri May 04, 2012 4:29 pm

Hi septeven! Thanks for the leads. I actually had a look at them before but iScroll isn't what I need and multiline box is a TextBox rather than a Text (I need that portion's background transparent!) The multiline box I think I will be using for the text entry part of the Chat Box though!
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Fri May 04, 2012 4:31 pm

Tell me exactly what you need.
I'm pretty sure that iScroll could help you on this. septeven2012-05-04 16:34:02
B
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » Fri May 04, 2012 4:41 pm

Well right now this is what I have:


And the Text portion of the textbox can be seen to the left. Right now after typing enough, the text, because each message is attached to the end, runs past the visible space of the textbox. I was hoping there was a version of the textbox which would let me scroll the text so I can see what's written at the bottom. Preferably the textbox would also shift the text so that the bottom most entry is visible. Will the iScroll plugin help with that?

Thanks for your help!
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Sat May 05, 2012 12:26 pm

Only load the last few lines into text object or whatever you're using there. It doesn't need to contain the entire log, does it?

And with some simple logic you can scroll. As easy as selecting the lines to display.Mipey2012-05-05 12:27:24
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun May 06, 2012 4:20 am

Hi @Mipey, that's a good idea, except the problem is I can't find out a way to decide how many lines are in the Text. For example, I can count newlines but text wrapping means that more lines are used than there are newline characters. Do you know any easy way to find out the number of lines in a Text object?

Thanks!
B
19
S
5
G
4
Posts: 85
Reputation: 4,925

Post » Sun May 06, 2012 8:53 am

Hm, you could try a while loop with the TextHeight expression.

+ While Text.TextHeight < ChatHeight
> Text.Append(a line to append)

It should stop adding a line when the chat height is exceeded. Oh, and add a guard condition to make sure it doesn't loop infinitely (such as if there aren't enough lines to fill the chat).
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun May 06, 2012 1:06 pm

Ohh really I didn't know there was a TextHeight expression. I will try it out. Thanks! :D
B
19
S
5
G
4
Posts: 85
Reputation: 4,925


Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest