Flex 4: Using 'truncateToFit' to truncate longer labels? Don't forget to mention 'maxWidth'!

Wednesday, August 29, 2012

Recently, I stumbled across another of the few tricks that are 'good-to-know' when it comes to flex development.

In order to make life easier Flex offers a property called truncateToFit with its lable component, thereby offsetting the developer to manually handle truncating long labels & appending '...' at the end.

But, it is noteworthy that only setting the truncateToFit Boolean does not suffice. You need to also mention the 'maxWidth' and/or 'width' property for the label.

<mx:Label text="Hello World!" truncateToFit="true" maxWidth="180"/>

No comments:

Post a Comment


About Me

My photo
Front-end Developer with over 9 years of experience in developing Web 2.0 sites with a keen eye for UX. Avid technology enthusiast; gadget freak; old school PC gamer; loves developing Apps & Data Visualizations.

My Website

Stack Overflow profile

Twitter Profile

Facebook profile