Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Creating multi line text fields — Gideros Forum

Creating multi line text fields

ar2rsawseenar2rsawseen Maintainer
edited January 2012 in Code snippets
Here is a way to split long text in multiple lines by providing limiting width of text (again as usually something I needed for my app). It's compatible with existing TextField object's methods (except initializing is different), and you can set bunch of additional stuff, like, line spacing, alignment, etc.

No dependencies for this one, so here's object's code

Example usage:
local text = TextWrap.new(str, 250, "justify")
text:setLineSpacing(5)
text:setPosition(10,10)
text:setTextColor(0xff0000)
stage:addChild(text)
And as usually, more info, sample project and video demo here: http://appcodingeasy.com/Gideros-Mobile/Creating-multi-line-text-fields-in-Gideros-Mobile

Feel free to use in your projects ;)
+1 -1 (+3 / -0 )Share on Facebook

Comments

  • is there a way to create a blank line?

    i tried the following but it only makes one line break, not two
    local text = "abc"
    text = text .. "\n" .. " " .. "\n"
    text = text .. "def"
     
    local textWrapper = TextWrap.new(text, 50, 50)
    Cheers
Sign In or Register to comment.