How can I get title Wordwrap a Panel?

Is there a way to set the title of a multiline sign? I have a panel where the title is dynamic. I don't know how long will be the title. As it works now, the the title occaisionally gets cut. Is there a way to wordwrap title a Panel?

" < mx:Panel id ="mySchoolPanel""

"title =" myTitle{}"

"width ="230"

         x="710" y="150"

headerHeight ="50" >

Thank you.

-Laxmidi

The logic of the layout of the Panel seems to assume a single line of text in the title, so to get the skin you must extend the class. I had a go at it below - will probably need a few adjustments:

package
{
    import mx.containers.Panel;

public class WrappingPanel extends Panel
    {
        // Hard coded padding above and below title text. Should be broken-out
        // into a style.
        private static const HEADER_PADDING : int = 6;
       
        protected override function createChildren():void
        {
            super.createChildren();
           
            titleTextField.wordWrap = true;
        }
       
        protected override function getHeaderHeight():Number
        {
            // Set the header height dynamically based on the height of the title
            return titleTextField.measuredHeight + HEADER_PADDING * 2;
        }
       
        protected override function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
        {
            super.updateDisplayList( unscaledWidth, unscaledHeight );
           
            // Set the height of the title to fit all text
            titleTextField.height = titleTextField.measuredHeight;
           
            // Position the title
            titleTextField.y = HEADER_PADDING;
        }
    }
}

Tags: Flex

Similar Questions

Maybe you are looking for