[Closed] multi-line label?
Is it possible to have more than one line in a single label? I’ve tried “\r” and “
” without any luck. Many thanks.
I think “
” does work, but you need to had extra height to your label using the height:someHeight parameter otherwise it will cut off your additional lines.
Hi, J_H. I know that height can be applied to editText, but to my knowledge alignment is a label’s only property.
edit: I stand corrected. I tried height:28 and it worked a treat. Thanks!
It is kinda neat, isn’t it? The multilines seem to default as a flush-left, but tapping the spacebar can let you at least approximate centered text.
If you want to center text, you can try a function such as the following.
fn centerString str width = (
local spaceWidth = (getTextExtent " ").x
local strWidth = (getTextExtent str).x
local numSpaces = ((width / 2.0) - (strWidth / 2.0)) / spaceWidth
local spaces = ""
for i = 1 to numSpaces do ( append spaces " " )
spaces + str
)
You’d have to split things up into multiple lines yourself before checking whether each line would need to be pre-padded, of course.
Quick example code for single-line use:
rollout test "test" (
-- bitmap is just there to frame the label
bitmap bmp_dummy "" width:102 fieldwidth:102 height:18 pos:[7,7]
label lbl_test "" width:100 height:16 pos:[8,8]
)
createDialog test
-- set a text the usual way (aligned left)
test.lbl_test.text = "Hello World"
-- set as centered
test.lbl_test.text = centerString "Hello World" 100 -- 100 = label width
It’s funny what you never try sometimes… this is new to me too…
I guess there’s no more dialogs defined like this!.. ha ha…
....
label LB01 "The Move Vert Functions of Vert to Mesh can be found directly below" Align:#center
label LB02 "the Vert To Mesh script in the Customize User Interface dialog." Align:#center
label LB03 "" Align:#left
label LB04 "\" Vert to Mesh - Move Verts \" - Moves selected Verts to Target Mesh" Align:#left
label LB05 "\" Vert to Mesh - Minus Soft Select\" - Subtracts Spinner Amount from falloff" Align:#left
label LB06 "\" Vert to Mesh - Plus Soft Select\" - Adds Spinner Amount to falloff" Align:#left
label LB07 "\" Vert to Mesh - Toggle Mesh\" - Toggles between Selected and Target Mesh" Align:#left
label LB08 "\" Vert to Mesh - Toggle Soft Select\" - Toggles Soft Select checkbox" Align:#left
label LB09 "\" Vert to Mesh - Toggle Z Only\" - Toggles Z Only function" Align:#left
label LB10 "" Align:#left
....
That’s a neat function too Zeboxx2…
Thanks!
It falls right in line with the Messagebox string display…
Messagebox " Hi There
This is a whole Line
WOW
WOW"