I'm trying to accomplish what should be an incredibly simple task but obviously I'm not understanding how TextField Layouts are supposed to work. I'm trying to get text to wrap which as far as I could tell should just be a simple matter of setting the w parameter for the textfield objects layout to the desired max width.
The code looks like this:
self.Text = TextField.new(Font.getDefault(),str,{w = initwidth, letterSpacing = 5})
self.Text:setPosition(self.x,self.y)
self:addChild(self.Text) |
where initwidth is a passed in number (244 in this case), str is just a lorem ipsum test string and the object gets added to the scene from main.lua.
Rather than working as I'd expect it to and wrapping the text once it exceeds the 244 pixel limit, the text just continues endlessly off screen like it didn't change a single thing. I've tried using the TextField:setLayout function after the fact instead of creating it with the layout as well but the results are the same. Am I misunderstanding how the Layouts are supposed to work here? Is text wrapping something I'll have to program in my own solution for or am I just simply doing something wrong?
Edit: As Mentioned down below, it seems the flags are initially set to no wrap causing the behaviour described above. The answer is a simple matter of changing the flags as you want or simply setting them to 0 as such:
self.Text = TextField.new(Font.getDefault(),str,{w = initwidth, letterSpacing = 5, flags = 0})
self.Text:setPosition(self.x,self.y)
self:addChild(self.Text) |
Comments
It must be:
Here is a working version:
Dislikes: rrraptor
Likes: MoKaLux
https://wiki.giderosmobile.com/index.php/UI_Text#Typewriter_Style_.40koeosstudio
Likes: SinisterSoft