Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Dionysius on August 16, 2008, 08:48:44 PM

Title: StaticControl.Text height
Post by: Dionysius on August 16, 2008, 08:48:44 PM
Is there any solution to calculate height of StaticControl.Text or to fit height of StaticControl to its Text?
Title: Re: StaticControl.Text height
Post by: mylesblasonato on August 17, 2008, 08:00:35 AM
There sure is. I will give you the caption window example since it uses text. Try this:

Code: [Select]
var win = Game.LoadWindow("interface\system\caption.window"); // Stores the window in the win variable.
global WinCaption = win.GetWidget("caption");// stores the win entity/widget "caption" in the global varible.
WinCaption.SizeToFit();// The important part. This resizes the control to fit the text size.

Remember this is an example. Don't copy and paste it because you will stuff up your caption window.

Cheers ::beer
Myles Blasonato.
Title: Re: StaticControl.Text height
Post by: Dionysius on August 17, 2008, 10:50:10 AM
Thank you!
Title: Re: StaticControl.Text height
Post by: mylesblasonato on August 17, 2008, 12:33:43 PM
No worries,
Write back and tell me if it worked.

Cheers ::beer
Myles Blasonato.
Title: Re: StaticControl.Text height
Post by: Dionysius on August 18, 2008, 03:41:04 AM
StaticControl.HeightToFit() works good for me :) I must was found it in documentation earlier. :)
Title: Re: StaticControl.Text height
Post by: mylesblasonato on August 18, 2008, 09:57:17 AM
No worries, glad to have helped.

Cheers ::beer
Myles Blasonato.