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
90
S
5
G
8
Posts: 164
Reputation: 7,646

Post » Mon Jan 02, 2012 8:51 pm

It's referring to the TextWidth and TextHeight expressions.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

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
90
S
5
G
8
Posts: 164
Reputation: 7,646

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
90
S
5
G
8
Posts: 164
Reputation: 7,646

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Mon Jan 02, 2012 9:04 pm

Look at this sample.

Text_Test
B
90
S
5
G
8
Posts: 164
Reputation: 7,646

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

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
90
S
5
G
8
Posts: 164
Reputation: 7,646

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
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Arima and 5 guests