Truncate the Level of the button To next line
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Truncate the Level of the button To next line
Hi, If the level of the button is long and I want to truncate it to next line (by increasing the height of the width) then how can we do this in live code?
Re: Truncate the Level of the button To next line
Hi pkmittal,
I think you mean the LABEL of a button?
You can do this:
1. With the messagebox (or any other script
set the label of btn 1 to ("This is line 1" & CR & "This is line 2 of the label")
2. In the inspector for the button enter BACKSLASH-N \n to add a new line:
This is line 1\nThis is line 2 of the label
Hope I understood you correctly.
Best
Klaus
I think you mean the LABEL of a button?
You can do this:
1. With the messagebox (or any other script
set the label of btn 1 to ("This is line 1" & CR & "This is line 2 of the label")
2. In the inspector for the button enter BACKSLASH-N \n to add a new line:
This is line 1\nThis is line 2 of the label
Hope I understood you correctly.
Best
Klaus
Re: Truncate the Level of the button To next line
Thanks. But I want to do it automatically if the label of the button does not fit in the width of the button then it should show the remaining next in new line..
So depending on width of the button, It should show the truncate the label from one line to another line..
So depending on width of the button, It should show the truncate the label from one line to another line..
Re: Truncate the Level of the button To next line
Ah, get it now!
Sorry, no idea how to do that..
Sorry, no idea how to do that..
Re: Truncate the Level of the button To next line
Try this:
Code: Select all
on setLabel pLbl
set the label of btn 1 to pLbl
if the formattedwidth of btn 1 > the width of btn 1 then
put the number of words in pLbl div 2 into tMiddle
put word 1 to tMiddle of pLbl & cr & word (tMiddle + 1) to -1 of pLbl into pLbl
end if
set the label of btn 1 to pLbl
end setLabelJacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Truncate the Level of the button To next line
Hi.
Jacque's trick should work. But what if the label requires three or more lines? It may never, but I bet you would get a kick out of writing a general solution, based on her methods.
Craig Newman
Jacque's trick should work. But what if the label requires three or more lines? It may never, but I bet you would get a kick out of writing a general solution, based on her methods.
Craig Newman
Re: Truncate the Level of the button To next line
Thanks a lot for your help
