mardi 28 mars 2017

Make a Text Field the same size as the font size

I was wondering if there is a way to make a Text Field the same size as the font used for the text inside of it.

One of the options that I've tried was:

mytextfield.height = mytextfield.textHeight 

But it didn't do the job, because textHeight is actually the height of the highest letter in the text, so that is not something you can rely on.

I've also tried using getTextFormat().size:

mytextfield.height = mytextfield.getTextFormat().size

But it returned:

error 1118 Implicit coercion of a value with static type Object to a possible unrelated type Number.

Aucun commentaire:

Enregistrer un commentaire