Question
Sizing a TextView to fit its contents (e.g., tooltip, chat bubble, etc.)
In Flex 3, with a Text component, I can make the component fit its contents (use case: multi-line tooltip, chat-bubble) so that I restrict the max width and the height grows as necessary.<br /><br />To do this in Flex 3, you need to patch the Text component, e.g.<br /><br /><?xml version="1.0" encoding="utf-8"?><br /><mx:Text xmlns:mx="http://www.adobe.com/2006/mxml"><br /> <!--<br /> Text fields do not wrap correctly as reported in this bug:<br /> https://bugs.adobe.com/jira/browse/SDK-12826<br /> <br /> This fix, suggested by Mike Schiff, fixes the issue, so that we can set a minWidth of 0, <br /> maxWidth, and width=100% and have speech bubbles correctly size themselves.<br /> https://bugs.adobe.com/jira/browse/SDK-12826#action_157090<br /> --><br /> <mx:Script><br /> <br /> override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {<br /> super.updateDisplayList(unscaledWidth, unscaledHeight);<br /> textField.wordWrap = textField.wordWrap || (Math.floor(measuredWidth) != Math.floor(width)); <br /> }<br /> <br /> </mx:Script><br /></mx:Text><br /><br />Then you can:<br /><br /><naklab:TextWithWrap<br /> htmlText="{someText}"<br /> width="100%"<br /> maxWidth="220"<br /> minWidth="0"<br /> fontWeight="normal"<br /> fontSize="12"<br /> color="#000000"<br />/><br /><br />I cannot find a way to do this with the TextView component in Gumbo. How would you recommend making a TextView component fit its contents and should I file an ECR on this or am I missing something? (Otherwise, how would you handle the use cases above in Gumbo?)<br /><br />Thanks,<br />Aral
