Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: StaticControl.Text height  (Read 3583 times)

0 Members and 1 Guest are viewing this topic.

Dionysius

  • Frequent poster
  • ****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 361
    • View Profile
    • On the Tracks of Dinosaurs
StaticControl.Text height
« 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?
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: StaticControl.Text height
« Reply #1 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.
« Last Edit: August 17, 2008, 08:03:41 AM by mylesb »
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Dionysius

  • Frequent poster
  • ****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 361
    • View Profile
    • On the Tracks of Dinosaurs
Re: StaticControl.Text height
« Reply #2 on: August 17, 2008, 10:50:10 AM »

Thank you!
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: StaticControl.Text height
« Reply #3 on: August 17, 2008, 12:33:43 PM »

No worries,
Write back and tell me if it worked.

Cheers ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Dionysius

  • Frequent poster
  • ****
  • Karma: 3
  • Offline Offline
  • Gender: Male
  • Posts: 361
    • View Profile
    • On the Tracks of Dinosaurs
Re: StaticControl.Text height
« Reply #4 on: August 18, 2008, 03:41:04 AM »

StaticControl.HeightToFit() works good for me :) I must was found it in documentation earlier. :)
Logged

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: StaticControl.Text height
« Reply #5 on: August 18, 2008, 09:57:17 AM »

No worries, glad to have helped.

Cheers ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38
 

Page created in 0.034 seconds with 24 queries.