10
Oct
07

Changing the background color of a disabled Flex TextInput control

The following example shows how you can use the backgroundDisabledColor style to customize the overlay color on a Flex TextInput control when the control’s enabled property is set to false.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/10/10/changing-the-background-color-of-a-disabled-flex-textinput-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:ApplicationControlBar dock="true">
        <mx:Label text="backgroundDisabledColor:" />
        <mx:ColorPicker id="colorPicker"
                selectedColor="white" />

        <mx:CheckBox id="checkBox"
                label="enabled:"
                labelPlacement="left" />
    </mx:ApplicationControlBar>

    <mx:TextInput text="The quick brown fox"
            backgroundDisabledColor="{colorPicker.selectedColor}"
            enabled="{checkBox.selected}" />

</mx:Application>

View source is enabled in the following example.


3 Responses to “Changing the background color of a disabled Flex TextInput control ”


  1. 1 coco Oct 11th, 2007 at 9:28 pm

    peter,
    Now i have a question:when i save my project,it will take me more time to finish it!at first time,it takes several seconds ,now it takes about 1 min! why does this status happen?how to solve this problem?
    coco

  2. 2 peterd Oct 12th, 2007 at 8:00 am

    coco,

    Try cleaning your project in Flex Builder using the Project > Clean menu command, and see if that helps.
    Also, are you using Flex Builder 2 or Flex Builder 3 Beta (and if FB3, are you using Beta 1 or Beta 2?)

    Peter

  3. 3 coco Oct 14th, 2007 at 6:10 pm

    peter,

    It’s usefull!Thanks!I am now using FB2!
    coco

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".