February 20, 2025, 07:59:16 PM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Forum rules
-
please read before posting, it can save you a lot of time.
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
SizeToFit problem
« previous
next »
Pages: [
1
]
Print
Author
Topic: SizeToFit problem (Read 5039 times)
0 Members and 1 Guest are viewing this topic.
Prote1n
Lurker
Karma: 0
Offline
Posts: 45
SizeToFit problem
«
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
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: SizeToFit problem
«
Reply #1 on:
December 02, 2009, 04:22:19 PM »
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...?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Prote1n
Lurker
Karma: 0
Offline
Posts: 45
Re: SizeToFit problem
«
Reply #2 on:
December 02, 2009, 06:33:53 PM »
I try both (| and ~n) with the same result. I actually solved the problem while splitting the string and calculating the maximum length
Logged
Prote1n
Lurker
Karma: 0
Offline
Posts: 45
Re: SizeToFit problem
«
Reply #3 on:
May 11, 2010, 03:31:40 PM »
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
Logged
metamorphium
Global Moderator
Addicted to WME forum
Karma: 12
Offline
Gender:
Posts: 1511
Vampires!
Re: SizeToFit problem
«
Reply #4 on:
May 13, 2010, 09:25:58 PM »
what's info.Height?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
Prote1n
Lurker
Karma: 0
Offline
Posts: 45
Re: SizeToFit problem
«
Reply #5 on:
May 18, 2010, 10:31:11 AM »
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
Logged
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
SizeToFit problem