Text Heigth and Width

Discussion and feedback on Construct 2

Post » Mon Jan 02, 2012 8:40 pm

I can`t see the `height or width extent of the text in the object in pixels` of a Text object in which I put some text with `Set Text`.

How it works?
B
110
S
12
G
8
Posts: 180
Reputation: 8,878

Post » Mon Jan 02, 2012 8:51 pm

It's referring to the TextWidth and TextHeight expressions.
Scirra Founder
B
395
S
232
G
88
Posts: 24,368
Reputation: 193,746

Post » Mon Jan 02, 2012 8:52 pm

TextWidth and TextHeight are two new expressions to the text object.

You can use them to know the current size in pixels of your text (its width and its height).

Edit: Ofc ninja'd ^^
@Tom: there should be a "Ninja" badge. And give it to Ashley by default Kyatric2012-01-02 20:53:56
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,293

Post » Mon Jan 02, 2012 8:54 pm

Hi Ashley,

Escuse me, but I dont understand yet?

Can you provide a sample, please?

Thanks
B
110
S
12
G
8
Posts: 180
Reputation: 8,878

Post » Mon Jan 02, 2012 8:56 pm

Kyatric,

I try to put both of this values in another text object to see it, but the result is 0.
B
110
S
12
G
8
Posts: 180
Reputation: 8,878

Post » Mon Jan 02, 2012 9:03 pm

New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,293

Post » Mon Jan 02, 2012 9:04 pm

Look at this sample.

Text_Test
B
110
S
12
G
8
Posts: 180
Reputation: 8,878

Post » Mon Jan 02, 2012 9:06 pm

Add a wait action 0.1 second between the first action (setting the text) and the second (displaying the size of the text).

Apparently, when you set the text, it gets updated/displayed only the following tick. So on the same tick, you have a "null" value for its size.

Check in my example above.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,293

Post » Mon Jan 02, 2012 9:07 pm

Oh Great Kyatric!!

Is my fault!!!

I forgot the WAIT.

Thanks a lot a Great happy New Year
B
110
S
12
G
8
Posts: 180
Reputation: 8,878

Post » Mon Jan 02, 2012 9:11 pm

Happy new year to you too.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
289
S
112
G
94
Posts: 7,333
Reputation: 69,293

Next

Return to Construct 2 General

Who is online

Users browsing this forum: jobel, Rastacity, Studio Mercato, Yahoo [Bot] and 4 guests