Skip to main content
mixedherbs
Participating Frequently
March 2, 2013
Answered

Getting width of dynamic text boxes containing different letters

  • March 2, 2013
  • 2 replies
  • 922 views

I have dynamic text boxes next to each other, each showing a letter and creating a word, any letter of English ABC. Since some letters are wider, how could I get the width of each letter to figure out spacing between them?

Thanks!!

This topic has been closed for replies.
Correct answer Ned Murphy

You can use the textWidth property of the textfield to get the width of the text inside it.

2 replies

mixedherbs
Participating Frequently
March 2, 2013

Thanks! Works prefectly!!

Ned Murphy
Legend
March 3, 2013

You're welcome

mixedherbs
Participating Frequently
March 3, 2013

I must add I got the textWidth work, came up with a simple formula to place the letters at an even distance, but still, some letters like capital W and P need less space after them to look nice. The second letter can be closer to them. No big deal, can be solved with an if statement, leave less space in case those letters are capitalized.

Ned Murphy
Ned MurphyCorrect answer
Legend
March 2, 2013

You can use the textWidth property of the textfield to get the width of the text inside it.