9 Replies Latest reply on Nov 19, 2010 10:11 AM by Peter deHaan

    how to change Disabled text color of spark TextInput?

    cheng.wei

      Hi Guys,

       

      The default disabled text color for spark TextInput is too light. It is difficult to see. So i want to make it a bit dark.

       

      The s:TextInput is placed inside mx:Form or s:Group actually, and i set its container to disabled.

       

      I tried with TextInputSkin, but without success.

       

      Thanks in advance,

      Cheng Wei

        • 1. Re: how to change Disabled text color of spark TextInput?
          Shongrunden Adobe Employee

          You could try changing the disabledAlpha style of the Group:

           

          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark">

           

              <s:Button label="toggle disabled" click="myGroup.enabled = myGroup2.enabled = !myGroup.enabled" />
             
              <s:Group id="myGroup" y="100">
                  <s:TextInput text="test" />
              </s:Group>
             
              <s:Group id="myGroup2" y="140" disabledAlpha="1">
                  <s:TextInput text="test" />
              </s:Group>
              
          </s:Application>

          • 2. Re: how to change Disabled text color of spark TextInput?
            Peter deHaan Level 4

            This works, if you set the enabled property directly on the s:TextInput:

             

            <?xml version="1.0" encoding="utf-8"?>
            <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                           xmlns:s="library://ns.adobe.com/flex/spark"
                           xmlns:mx="library://ns.adobe.com/flex/mx">
                <s:layout>
                    <s:VerticalLayout horizontalAlign="center" verticalAlign="middle" />
                </s:layout>
                <s:controlBarContent>
                    <s:CheckBox id="ch" label="enabled" selected="true" />
                </s:controlBarContent>
            
                <fx:Style>
                    @namespace s "library://ns.adobe.com/flex/spark";
                    @namespace mx "library://ns.adobe.com/flex/mx";
            
                    s|TextInput:disabled {
                        color: red;
                    }
                </fx:Style>
            
                <s:Group>
                    <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{ch.selected}" />
                </s:Group>
            
            </s:Application>
            
            
            
            It can get a bit trickier when you're setting the enabled property on a parent container, since (I believe) that the child control's enabled properties are still set to true and just the container is disabled. One possible workaround would be to bind the child TextInput control's enabled property to the container's enabled property. That way the s:TextInput should still go to it's disabled state and you can customize the disabled state's styles to have darker text, or whatever else you want.
            <s:Group id="gr" enabled="{ch.selected}">
                <s:TextInput id="ti" text="The quick brown fox jumps over the lazy dog" enabled="{gr.enabled}" />
            </s:Group>
            
            Peter

            • 3. Re: how to change Disabled text color of spark TextInput?
              FTQuest Level 3

              @ peter

               

              Hi Peter,

               

              this is off-topic. Just to let you know: while trying to visit  your site blog.flexexamples.com I received Google warning that the site contains malware - a trojan.

              Screen shot 2010-11-17 at 3.18.19 PM.png

              FTQuest

              • 4. Re: how to change Disabled text color of spark TextInput?
                Peter deHaan Level 4

                Yeah, thanks.

                I noticed that early this morning and filled out the forms on Google.com to have them un-blacklist my domain. I did a few security scans and Sucuri.net didn't find any malware or anything bad in my files. I'll take another look at my .htaccess files once I get home tonight and can look a bit deeper.

                 

                Sorry about that,

                Peter

                • 5. Re: how to change Disabled text color of spark TextInput?
                  FTQuest Level 3

                  Your site has been a great source of help to many people.

                   

                  Just in case, here is what Google considers malicious:

                  Malicious software includes 1 trojan(s). Successful infection resulted in an average of 2 new process(es) on the target machine.

                   

                  Malicious software is hosted on 1 domain(s), including 78.26.187.0/.

                   

                  1 domain(s) appear to be functioning as intermediaries for distributing malware to visitors of this site, including hcg-diet-solution.com/.

                   

                  This site was hosted on 1 network(s) including AS31815 (MEDIATEMPLE).

                   

                   

                  Regards,

                  Igor Boroding

                  • 6. Re: how to change Disabled text color of spark TextInput?
                    Peter deHaan Level 4

                    OK, sorry about that. Looks like this is fixed (at least on the 3 machines I've tried, as well as Google's Webmaster Tools section, and Sucuri.net's blacklist scanner). Whew!

                     

                    Peter

                    • 7. Re: how to change Disabled text color of spark TextInput?
                      cheng.wei Level 1

                      Hi Peter,

                       

                      Thanks a lot, get it solved. I guess i was also trying to have a look one of your article which seems to related to this problem before, but could not :).

                       

                      Cheers,

                      Cheng Wei

                      • 8. Re: how to change Disabled text color of spark TextInput?
                        FTQuest Level 3

                        Hi Peter,

                         

                        Just in case you are NOT aware, your site is still unaccessible.

                        The error message:

                         

                        Error establishing a database connection

                         

                        FTQuest.

                        • 9. Re: how to change Disabled text color of spark TextInput?
                          Peter deHaan Level 4

                          Thanks again.

                          I rebooted the server and it looks like it is back up.

                           

                          Peter