6 Replies Latest reply on Jun 17, 2007 9:53 AM by marcfain

    Hidden line in Text

    marcfain
      I've spent quite a while for figuring this out (without success): Text seems to render an additional line at the bottom. Use this:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Text id="te" width="150" text="The Text control displays multiline, noneditable text. Use the Label control if you need only a single line of text." />
      </mx:Application>

      Click into the text field and drag it to the bottom (or press page down). What bugs me is that you can hide the first line of Text and this is certainly not a usability goody...

      Disabling selectable hinders the scrolling but I need to have it selectable.

      Any ideas how solve this?
        • 1. Re: Hidden line in Text
          JabbyPandaUA
          You forgot to specify height attribute for mx:Tree

          <mx:Text id="te" width="150" height="100%" text="The Text control displays multiline, noneditable text. Use the Label control if you need only a single line of text." />
          • 2. Re: Hidden line in Text
            marcfain Level 1
            Thanks for the solution. I made a simplification of my real problem and I didn't notice that I cut out the original problem. This one is closer to the height problem:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
            <mx:Grid width="150">
            <mx:GridRow width="100%">
            <mx:GridItem width="100%">
            <mx:Text width="100%"
            htmlText="The Text control displays multiline, noneditable text. Use the Label control if you need only a single line of text." />
            </mx:GridItem>
            </mx:GridRow>
            <mx:GridRow width="100%">
            <mx:GridItem width="100%">
            <mx:TextArea width="100%"
            htmlText="The Text control displays multiline, noneditable text. Use the Label control if you need only a single line of text." />
            </mx:GridItem>
            </mx:GridRow>
            </mx:Grid>
            </mx:Application>

            Text shows nicely except for the additional line I want to get rid of. And TextArea does not at all display as desired.
            Any suggestions?
            • 3. Re: Hidden line in Text
              JabbyPandaUA Level 3
              Why you had not specify attribute 'height' for mx:Text and mx:TextArea in your code sample?
              • 4. Re: Hidden line in Text
                marcfain Level 1
                Thanks for coming back JabbyPandaUA. Let's play a bit with the height:

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
                <mx:Grid width="400">
                <mx:GridRow width="100%">
                <mx:GridItem width="200">
                <mx:Text width="150"
                htmlText="width=150, height=null. Additional line present." />
                </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow width="100%">
                <mx:GridItem width="200">
                <mx:Text width="100%"
                htmlText="width=100%, height=null. Additional line present." />
                </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow width="100%">
                <mx:GridItem width="200">
                <mx:Text width="100%" height="200"
                htmlText="width=100%, height=300. No additional line. This looks great but in reality, the height shall be given by the length of text and not explicitly." />
                </mx:GridItem>
                </mx:GridRow>
                <mx:GridRow width="100%">
                <mx:GridItem width="200">
                <mx:Text width="100%" height="100%"
                htmlText="width=100%, height=100%. There is just one line displayed, as there is no return in text." />
                </mx:GridItem>
                </mx:GridRow>
                </mx:Grid>
                </mx:Application>

                You see the result described in the text of the Text field. So, setting height as done above does not solve the issue. Maybe you had another way in mind?

                Also, in "Flex 2 Developer’s Guide" under "Text": - If you specify an explicit pixel width, but no height, Flex wraps the text to fit the width This is true except for this annoying additional line!

                Next paragraph: If you specify a percentage-based width and no height, Flex does not wrap the text, and the
                height equals the number of lines as determined by the number of Return characters.
                No! See row 2, there are 2 lines displayed but the text does not contain any returns.
                • 5. Re: Hidden line in Text
                  yu.wei.qian.07
                  play with the condenseWhite Property of the text.
                  • 6. Re: Hidden line in Text
                    marcfain Level 1
                    Good point with condenseWhite . However, in the sample I pass the text without any line breaks. So fumbling with condenseWhite does not bring light into the dark...

                    Is this such a bloody easy thing to do right or is it a real problem???