2 Replies Latest reply on Jun 23, 2009 5:23 PM by Flex harUI

    Show the carat in a TextArea without focus

    Delpharah

      Anyone know how to show the carat in an Air TextArea without it having focus (in other words, ALWAYS show where the insertion point is no matter what). I've tried everything and even resorted to calculating the text metrics and drawing my own carat, but that doesn't work too well since I think getLineMetrics() was just a joke put in to piss off developers.

        • 1. Re: Show the carat in a TextArea without focus
          Flex harUI Adobe Employee

          If alwaysShowSelection doesn't work, you'll have to draw your own.  What problems were you having with getLineMetrics?  Could it be that you're doing the calculations before the TextArea has its final size?

           

          Alex Harui

          Flex SDK Developer

          Adobe Systems Inc.

          Blog: http://blogs.adobe.com/aharui

          • 2. Re: Show the carat in a TextArea without focus
            Delpharah Level 1

            That might be one of my problems. My main problem with it is that I'm using a TextArea that has wordwrap enabled. I've found that, even if there's (visibly) 20 lines in a textarea, it is still just considered one line for getLineMetrics() until it finds a line break. Since wordwrap pushes words to the next line as to not cut off or split up any words, it seems nearly impossible to find exactly where the carat is supposed to be.

             

            I also have to make minor adjustments to a couple letter sizes (it calculates i 1 pixel less, m is 2 pixels less, etc). This may be related to what you mentioned. If so, how should I get around that?