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
106
S
11
G
8
Posts: 179
Reputation: 8,676

Post » Mon Jan 02, 2012 8:51 pm

It's referring to the TextWidth and TextHeight expressions.
Scirra Founder
B
384
S
227
G
86
Posts: 24,139
Reputation: 190,761

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
276
S
103
G
84
Posts: 7,289
Reputation: 83,100

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
106
S
11
G
8
Posts: 179
Reputation: 8,676

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
106
S
11
G
8
Posts: 179
Reputation: 8,676

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
276
S
103
G
84
Posts: 7,289
Reputation: 83,100

Post » Mon Jan 02, 2012 9:04 pm

Look at this sample.

Text_Test
B
106
S
11
G
8
Posts: 179
Reputation: 8,676

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
276
S
103
G
84
Posts: 7,289
Reputation: 83,100

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
106
S
11
G
8
Posts: 179
Reputation: 8,676

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
276
S
103
G
84
Posts: 7,289
Reputation: 83,100

Next

Return to Construct 2 General

Who is online

Users browsing this forum: gumshoe2029 and 2 guests