Dzejki Posted January 18, 2014 Share Posted January 18, 2014 I want to know if it is possible to do text wrapping. I mean like wordBreak option in DX https://wiki.multitheftauto.com/wiki/DxDrawText But I want to do this option in guiLabel, is it possible? Link to comment
Wei Posted January 18, 2014 Share Posted January 18, 2014 Yes it is ! guiLabelGetTextExtent Link to comment
Dzejki Posted January 18, 2014 Author Share Posted January 18, 2014 I think you don't understand me. I dont wan't text on one line but I want automatic enter if text is at the end of label. How I can use this fucntion to do sth like that? Link to comment
TAPL Posted January 18, 2014 Share Posted January 18, 2014 I think this is what you need. guiLabelSetHorizontalAlign Link to comment
Wei Posted January 18, 2014 Share Posted January 18, 2014 wordBreak: if set to true, the text will wrap to a new line whenever it reaches the right side of the bounding box. If false, the text will always be completely on one line. He means that I think Edit you can also try scripting it like this function string.insert(value, insert, place) if place == nil then place = string.len(value)+1 end return string.sub(value, 1,place-1) .. string.gsub(string.sub(value, place,place), string.sub(value, place,place), insert) .. string.sub(value, place, string.len(value)) end local characterFitLabel = 15 -- Example that 15 characters fit label local labeltext = "Example of text 123" label = guiCreateLabel(20, 20, 50, 305, labeltext, false) if (#labeltext >= characterFitLabel) then labeltext = string.insert( labeltext, "\n", characterFitLabel ) guiSetText(label, labeltext) end This is just an example, I don't know if it will work Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now