multiple line buttons

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Ellery
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6
Joined: Tue Feb 26, 2013 9:10 pm

multiple line buttons

Post by Ellery » Thu May 30, 2013 12:45 am

Is there a way to make the name of a button break and go on multiple lines so you can fit bigger font on a smaller screen?

Ellery

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: multiple line buttons

Post by sturgis » Thu May 30, 2013 12:49 am

If you "set the label of button "buttonname" to ("My first line" & cr & "my second line") it will work. Or you can turn off the display of the label in properties and overlay a label field, or you can create an image that has the text you want to show, in the size you want to show it, and set the icon of the button to that image.

Ellery
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6
Joined: Tue Feb 26, 2013 9:10 pm

Re: multiple line buttons

Post by Ellery » Thu May 30, 2013 4:16 am

I tried the first way and it isnt working? It shows "My first line" & cr & "my second line" but they dont break at the " & cr &" is there some setting I need to check? The label idea works nicely. The problem with using an image is it looks very rough when scaling from an I-phone screen (320x 480) to a i-pad retina or google tablet( I think there new 10" tablet is 2600x1800). Im trying to make my app so it works on all devices. Thank you for your help though if I cant get the first way to work I will probably just use a label!
Ellery

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: multiple line buttons

Post by icouto » Thu May 30, 2013 6:47 am

I think the problem there may that you may be trying to type the code into the Inspector. Try typing it into the message box, like this:

Code: Select all

set the label of button "myButton" to "line 1" & return & "line 2"
Note that I am using "return" instead of "cr".
Alternatively, you can put this code in the script of the button itself:

Code: Select all

on mouseUp
  set the label of me to "line 1" & return & "line 2"
end mouseUp
Both should work. :-)

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: multiple line buttons

Post by Klaus » Thu May 30, 2013 12:20 pm

Hi Ellery,

you CAN indeed enter multiline LABELS for buttons in the inspector!

Looks like Livecode uses FORMAT to check and apply the entered text
as a buttons label, so you can use the NEW LINE characters BACKSLASH + n
instead of a "real" RETURN (CR) in the inspector.

Copy this line to the LABEL field in the inspector and see yourself:
line 1\nline 2

Or this one:
line 1\nline 2\line 3\nline 4\netc...

:-)

Best

Klaus

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: multiple line buttons

Post by sturgis » Thu May 30, 2013 1:07 pm

Hey thats cool klaus! Didn't know you could do that. Thanks!

Ellery
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 6
Joined: Tue Feb 26, 2013 9:10 pm

Re: multiple line buttons

Post by Ellery » Thu May 30, 2013 5:46 pm

ok awesome thank you everyone!

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”