Better FormItem

Tagged:  

How to create a FormItem that has a multiline label.

I made an extension to FormItem that lets you do a few things that the native FormItem cannot do.

  • Multiline labels
  • Selectable labels
  • Max width labels

Example of how to use BetterFormItem.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:extended="com.nbilyk.flex.extended.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]" fontSize="14">
	<mx:Form width="400" horizontalCenter="0">
		<extended:BetterFormItem selectable="true" multiline="true" label="This is some text that is very long and needs to wrap. How 'bout that?" maxLabelWidth="180">
			<mx:TextInput text=""/>
		</extended:BetterFormItem>
		<extended:BetterFormItem selectable="true" multiline="false" label="Also long, but this time we won't wrap." maxLabelWidth="180">
			<mx:TextInput text=""/>
		</extended:BetterFormItem>
	</mx:Form>
</mx:Application>

Click here to download and view the source.

This site requires the Flash player to display correctly. Go to http://www.adobe.com/go/getflash/ to download this plugin.



Muchas gracias !!! .... thanks a lot .... this component was so useful to me !!

... with your component!! :)

Thanks!

Andrew.

Hey Nick,

Thanks very much for putting this together, it actually helped me a lot.
Now... I know I'm so demanding :) but anyway: do you know how could I make your "BetterFormItem" display properly while in "Design time"? "Design time" is usually the name of what I see inside Flex Builder when switching to "design" instead of "source".

Thanks a lot,
Claudius

Design view is dodgy at best. Unfortunately, most of the things I do I disregard design view because I never use it and it is usually more time than it's worth to get things working in it.

I really need this...thanks so much m8..
ravi.

Thank you, this is what i'm looking for, almost half a year :D

Regards,
Anh