Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: .M.M. on Tue 07/04/2020 16:35:55

Title: Break line of text displayed on a button issue [SOLVED, not possible]
Post by: .M.M. on Tue 07/04/2020 16:35:55
Hi,

I've briefly searched the forum and found nothing about the issue. I wonder how to make line breaks for button text? To make sure it's not a general problem, I've tried copying label text to a button (both have the same size):

Code (ags) Select

lblTest.Text = "Test[label";
btnTest.Text = lblTest.Text;


While the label text is placed on two lines, button text stays on one with the character [ visible. Copying the text from the button back to the label, and the label text spreads on two lines again.
Is there any way to solve this?
Title: Re: Break line of text displayed on a button issue
Post by: Crimson Wizard on Tue 07/04/2020 17:04:14
I don't believe buttons in AGS support multiline text at all.

You may try drawing wrapped text on a dynamic sprite and placing on a button, or scripting your own button (but in the last case you'd also have to implement custom click events, etc).
Title: Re: Break line of text displayed on a button issue
Post by: Cassiebsg on Tue 07/04/2020 17:09:35
You can "fake" a button if need be. You can turn labels to be clickable.  ;) So you could have the text on a clickable label over a button... or just a normal non-clickable label over a clickable label (I think the click will go thru, if not use the clickable label trick).

If you want them to animate, like they do with normal buttons on mouse over, you'll have to code it your self, but it's also possible.

Hope these tips helps you achieve what you want.  ;)
Title: Re: Break line of text displayed on a button issue [SOLVED, NOT POSSIBLE]
Post by: .M.M. on Tue 07/04/2020 17:27:00
Thank you for your quick replies! And your suggestions, too.  :)

Quote from: Crimson Wizard on Tue 07/04/2020 17:04:14
I don't believe buttons in AGS support multiline text at all.

Hmm, how come I haven't noticed in... 15 years of using AGS? Shame on me!  :-D

I need to display changeable graphic and at least two lines of text on multiple buttons, so I'll just use a button with a dedicated label for each "entry". Thanks!
Title: Re: Break line of text displayed on a button issue [SOLVED, not possible]
Post by: Khris on Thu 09/04/2020 11:45:54
Btw, you can always draw text of a certain maximum width to a dynamic sprite and set the result as button image.