Break line of text displayed on a button issue [SOLVED, not possible]

Started by .M.M., Tue 07/04/2020 16:35:55

Previous topic - Next topic

.M.M.

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

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?

Crimson Wizard

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).

Cassiebsg

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.  ;)
There are those who believe that life here began out there...

.M.M.

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!

Khris

Btw, you can always draw text of a certain maximum width to a dynamic sprite and set the result as button image.

SMF spam blocked by CleanTalk