how to get a Flex text control to word wrap

后端 未结 9 1997
生来不讨喜
生来不讨喜 2020-12-29 02:50

I\'m creating an Adobe Flex application and I have a Text control (mx:Text), which is supposedly used when you need multiline noneditable text (as opposed to a Label, which

相关标签:
9条回答
  • 2020-12-29 03:25

    I could do it using only mxml. The result is quite ugly, but I could do it.

    <s:Group id="propDisplay" width="100%">
        <mx:Text id="key" left="0" text="{data.key}:"/>
        <mx:Text left="{key.width}" maxWidth="{propDisplay.width - key.width}" 
                                 text="{data.value}" />
    </s:Group>
    
    0 讨论(0)
  • 2020-12-29 03:27

    So Christian's example of just an Application with a Text element inside work, but it is far too easy to screw up the layout. Just add one VBox inbetween and wrapping does not work:

    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="100%" height="100%">
    <mx:VBox width="100%">
        <mx:Text width="100%" height="100%" text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." />    
    </mx:VBox>
    </mx:Application>
    
    0 讨论(0)
  • 2020-12-29 03:27
    render="invalidateSize();validateNow();
    'component id'.mx_internal::getTextField().wordWrap=true"
    

    add this to your text component.

    0 讨论(0)
提交回复
热议问题