• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

center dialog text

Status
Not open for further replies.
Level 9
Joined
Jul 10, 2011
Messages
562
hey guys ;D

how it's possible that the text of a dialog (the title not the text on the buttons) is centered and not left-aligned automatically? or is it even possible at all? with a command like |n for a line break for example....would be nice to know because up to now it looks really bad^^

thanks in advance

greetz clapto
 
Level 9
Joined
Jul 10, 2011
Messages
562
mine is to long to i had to use |n and so just the first line is centered and the rest is left-aligned....and so i need to have something to center that text.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
What about using spaces?
In the GUI text editor (standard, I don't use the JNGP one) you can easily see how the text gets alligned.
It will look exactly the same as it does in there, but I guess images can explain this better than me.


XXpSN.jpg


4uGWm.jpg


If you're going to convert that to a JASS string, remove all the enters and replace them with line breaks.
It should work.
 
Level 9
Joined
Jul 10, 2011
Messages
562
the problem is that the text is a bit more difficult ^^
the number of letters differ every time because there are words changing so i cant use spaces...secondly the text is made of concatenate strings nd so adjustment is (at least afaik) impossible that way xD

any suggestions now how i can center the text?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
This seems to be more difficult than I had thought :/.
My first response was "Hey, what if I make a table of the width of all characters and then loop through the string to see how large the offset must be and add an equivalent amount of spaces?".
And I'm still stuck with that as my only idea :(. (Well, I did think about changing the color of part of the string to make it invisible. That would make it easier, but it's impossible to get it perfectly invisible).
 
Status
Not open for further replies.
Top