Tuesday, March 23, 2010

TextInput as Label

I have often seen the need to make a TextInput behave like a Label. This need generally comes from a form which is in editable/read only mode.

Here is a TextInput mxml that shows you what properties and styles need to change to make the TextInput behave like a Text or Label.


<com:TextInput text="prashant"
backgroundAlpha="0" borderStyle="none"
editable="false" focusThickness="0"/>

I remember seeing an example posted by someone where a Label was included inside the TextInput and then with the help of some black magic, the Label is displayed and UITextField inside the TextInput is made invisible. I liked my solution more for the simple fact that it does not have to add any extra uicomponents and works on the same object which is the UITextField.

Click here for a demo
View source: Right click demo, or download from here

The demo extends the TextInput class and adds a new property called "useAsLabel".

Labels: , ,

1 Comments:

At February 2, 2022 at 6:30 AM , Anonymous Anonymous said...

Lucky Club Casino Site: A Guide to Gaming
Lucky Club Casino is a casino with a large amount luckyclub of games and an attractive welcome bonus. This means if you like to play slots, we highly recommend you

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home