3 Replies Latest reply on Aug 26, 2008 10:49 PM by Ratsnackbar

    horizontalGap, maybe?

      I've got this small app that lays Labels out in an HBox. I want to decrease the space between the Labels, but can't seem to do it. Changing horizontalGap on other containers seems to work the way i think it should, but not here. Any suggestions?
        • 1. Re: horizontalGap, maybe?
          Ratsnackbar Level 2
          Any reason you are using Label instead of Text?

          The Text component will collapse to the size of what is in it but the label will have space on the right which is where your extra space is coming from.

          The label does this as part of it's standard formatting to allow it to stand off a bit from whatever it is labeling without you having to add extra formatting.

          If you switch your labels to simply Text components I believe you will find you get the effect you want.
          • 2. Re: horizontalGap, maybe?
            rwadkins_nyc Level 1
            Well, firstly because of this from http://livedocs.adobe.com/flex/3/langref/mx/controls/Text.html


            The Text control displays multiline, noneditable text. Use the Label control if you need only a single line of text.

            But Text seems unnecessarily complicated with the whole childnode thing. (btw, can you tell I'm new to Flex?)

            is the padding not adjustable on Label?
            • 3. Re: horizontalGap, maybe?
              Ratsnackbar Level 2
              I tip my hat to anyone who has actually read the livedocs first before posting here. In most cases I would also suggested to follow the API.

              In this case however I would still suggest using Text as long as you understand how it will react if your HBox gets too small. I.E. it will wrap unless you have set the width to a percentage.

              Text subclasses Label but handles the space around itself the way I believe you are thinking a label should.

              The label control is more of a container that has text in it and the minimum size of the container does not honor the dimensions of the font once the width gets smaller then the height. Instead it just tends to end up square at that point. Text control honors the spacing around the font of the item inside it.

              So for example if there was a single character "1" in a label control with your CSS options above the width of the label control itself will be the same as the height of the character plus the top and bottom padding. But in a Text control the width is the width of the font of the character plus the left and right padding.

              Not sure if that is how it was intended but in my experience that is how it displays.

              (Sorry did not intend to explain so much just to say I still would use text.)