01-03-2011 12:44 PM
Is it possible to create single-line TextField with predefined width to keep X characters? I mean displayable width (not maxChars) when border is visible.
Solved! Go to Solution.
01-03-2011 12:48 PM
01-03-2011 12:53 PM
Depending on what you're trying to do specifically, one option that may work is to change your font to a fixed-pitch font. Courier is a common one though there's also a BBAlpha Mono and others. In a fixed-pitch (also known as "monospace") font, all characters are the same width.
There are also flash APIs for font metrics and such that will let you discover the exact pixel size of various characters or pieces of text at various font sizes.
01-03-2011 12:59 PM
01-03-2011 01:02 PM
It will contain only numbers.
How I can calculate width of string such "99.99" using specific font settings?
How I can set width of TextField?
Is it possible to draw TextField's background as rounded rect?
01-03-2011 01:12 PM
01-03-2011 01:46 PM
01-03-2011 01:59 PM
Are you entering the number and you want the size of the entry to change with the numbers entered?
Or, is the values just a read-only label that you want to just have a bounding box (rounded) around it?
I'm entering numbers but I wish that TextField has static width which can keep maxChars. So there are 2 questions:
1. How to me measure text;
2. How to setup width of TextField
01-03-2011 02:04 PM
01-03-2011 02:21 PM
You can measure text using flash.text.TextField.getLineMetrics(). You should be able to find numerous examples on the web.
How to set TextField's width? It doesn't has setSize() method.