I’ve been going through older code and switching it out with more efficient processes. I’ve run into a bit of trouble, though, and can’t get the linebreaking mode to work on my GUI node.
function defChat(self,node)
gui.set_size_mode(node,gui.SIZE_MODE_MANUAL)
gui.set_size(node,vmath.vector3(self.lineWidth,chatProperties.height,0))
gui.set_parent(node,gui.get_node("Chatbox"))
gui.set_line_break(node,true)
gui.set_font(node,self.font.name)
gui.set_pivot(node,gui.PIVOT_W)
gui.set_color(node,chatColor)
incline = 0
print("CHAT NODE SIZE: ".. gui.get_size(node))
end
The node is given it’s definitions with this function. I later write a message on the node as to was it is supposed to display. I have it run on a stamping function which quickly, but noticeably, prints out the letters from the original message and adds them to the node. Note, this text is applied to the node after I tell the node it should linebreak. I’m not sure if this matters, but I tested it and it seems it doesn’t work either way.
The node is given a width of around 300 pixels with self.lineWidth. Every time I write a message larger than that, linebreak seems to be broken. The messaging system works perfectly, except for when I write large messages. It’s supposed to linebreak them as they get larger in the stamping process, and then achieve enough space for it to nest in height-wise. It is currently being printed out in one large string, exceeding the width of the node containing it, instead of multiple lines.
Correct me if I’m wrong, but the linebreaking function takes into account the size of the node and linebreaks the text to remain inside it’s width, right? Or does it also take into account the height of the node?