0 Replies Latest reply on Feb 15, 2009 7:00 PM by SiHoop

    How wide is a text field?

    SiHoop Level 1
      I'm developing an application in which I need to know the exact location of dynamically generated text. My problem is that when I monitor the width of an expanding text field, my prediction concerning where a line break will appear does not match reality! In the code below, I get the following trace indicating the a line break should be placed immediately following the letter "f". This is because the text field width is already 78 pixels and the next characters (i.e gi|| ) cover an additional 23 pixels which together covers more than the width of the text field (i.e. 100 pixels). So how do I accurately measure the width of the text field and predict a line break? Thanks for your time!
      Trace results:
      Char width=13 Char=a Text field width=13
      Char width=14 Char=b Text field width=27
      Char width=13 Char=c Text field width=40
      Char width=14 Char=d Text field width=54
      Char width=13 Char=e Text field width=67
      Char width=11 Char=f Text field width=78
      BREAK
      Char width=23 Char=gi|| Text field width=23