Change the text Size based on amount of content
Hi, I have selected "Auto" in text size of a text field. Now, I want to set its size to 10 pt. If the text field gets filled, the text size should reduce to 8 pt. I first tried to implment it based on length of text (characters), code is given below.
On Focus,
event.target.textSize = 0;On Blur,
var len = event.target.value.toString().length;
if (len < 7) {
event.target.textSize = 10;
}
else {
event.target.textSize = 0;
}but issue with this strategy is that different characters have different width that makes it difficult to implement it using above code, as the content of different text boxes looks with different random font sizes.
I want to know if there is a way to implement it using "event.fieldFull" techniue or any other overflow detection. If text is not overflown, text size should be 10, if it overflows, it should be 8 pt.
