Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: Prote1n on December 02, 2009, 03:00:46 PM
-
This function does not take into account the line break
The text "aaa|bbb|ccc|ddd" has the size of "aaabbbccddd" instead of the maximum of the splitted string... but the HeightToFit is well calculted
-
How exactly are you using the method? If you're setting the text from script, you should use the "~n" sequence for newlines, not the | character.
SomeControl.Text = "aaa~nbbb~nccc~nddd";
SomeControl.SizeToFit();
...should work, I think...?
-
I try both (| and ~n) with the same result. I actually solved the problem while splitting the string and calculating the maximum length
-
Here is my script:
var win=Game.LoadWindow("interface\system\info.window");
var info = win.GetControl("message");
info.Text = "abcdefghijklnmnopqrstuvwxyz";
info.SizeToFit();
Game.LOG (info.Width); // RETURNS 236
info.Text = "abcdefghijkl|nmnopqrstuvwxyz";
info.SizeToFit();
Game.LOG (info.Width); // RETURNS 248
info.Text = "abcdefghijkl~nnmnopqrstuvwxyz";
info.SizeToFit();
Game.LOG (info.Width); // RETURNS 248
-
what's info.Height?
-
var win=Game.LoadWindow("interface\system\info.window");
var info = win.GetControl("message");
info.Text = "abcdefghijklnmnopqrstuvwxyz";
info.SizeToFit();
Game.LOG (info.Height); // RETURNS 19
info.Text = "abcdefghijkl|nmnopqrstuvwxyz";
info.SizeToFit();
Game.LOG (info.Height); // RETURNS 38
info.Text = "abcdefghijkl~nnmnopqrstuvwxyz";
info.SizeToFit();
Game.LOG (info.Height); // RETURNS 38