Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Calin Leafshade on Sat 20/02/2010 20:04:46

Title: Scrolling a Label
Post by: Calin Leafshade on Sat 20/02/2010 20:04:46
So I'm coding an email program style GUI and i need a way to 'scroll' a label.

I display the text in a label using [ as line breaks but if the text is too long for the label how can I have a button which scrolls the email down or up a line?

Title: Re: Scrolling a Label
Post by: Dualnames on Sat 20/02/2010 20:07:43
Quote from: Calin Leafshade on Sat 20/02/2010 20:04:46
So I'm coding an email program style GUI and i need a way to 'scroll' a label.

I display the text in a label using [ as line breaks but if the text is too long for the label how can I have a button which scrolls the email down or up a line?



I'd use a listbox, and listbox items every line you end with ]. Then it's really easy to do scrolling..apparently. :D
Title: Re: Scrolling a Label
Post by: Calin Leafshade on Sat 20/02/2010 20:10:00
do list boxes automatically wrap lines though?

I wouldnt like to have to end each line with [ if it was just to wrap around
Title: Re: Scrolling a Label
Post by: NsMn on Sat 20/02/2010 20:10:21
You could also just move the Label around on the GUI and cover the text that's supposed to be over the border under two non-clickable buttons if needed.
Title: Re: Scrolling a Label
Post by: Calin Leafshade on Sat 20/02/2010 20:13:53
That wouldnt really work due to the arrangement of the GUI.

I think this would probably require pretty extreme string manipulation functions so i'm kinda thinking it will be monkey who answers this :D
Title: Re: Scrolling a Label
Post by: GarageGothic on Sat 20/02/2010 20:21:42
You COULD use the listbox thing but with a helper script to do the linebreaking for you. But an easier solution could be to make the text display box as a label on its own GUI overlaid the other GUI and simply move the label up and down as NsMn suggested.
Title: Re: Scrolling a Label
Post by: Calin Leafshade on Sat 20/02/2010 20:22:49
I never thought of putting it on its own gui.. that would work.

Edit: Yup that works like a charm. Thanks kids