ErrorString and borderColor of controls not in sink

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ErrorString and borderColor of controls not in sink

ilikeflex
Hi

When errorString of the component is any value(ex 'Enter the value') then the borderColor of the component changes to 'red'. But when you make the errorString="" it does not change the borderColor of the component back for the first time.

It change when the control lose focus.

How can we make the border color to original when using errorString="" for the first time even the control does not loose focus.

I have attached sample of the problem.

Any pointers..

<?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" minWidth="955" minHeight="600">
        <fx:Script>
                <![CDATA[
                        import mx.utils.StringUtil;
                        protected function textarea1_changeHandler(event:Event):void
                        {
                                // TODO Auto-generated method stub
                                if (StringUtil.trim((event.target as TextArea).text).length == 0)
                                {
                                        (event.target as TextArea).errorString = 'Enter any value';
                                }
                                else
                                {
                                        (event.target as TextArea).errorString = "";
                                }
                        }
                ]]>
        </fx:Script>
       
        <fx:Declarations>
                <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:layout>
                <s:VerticalLayout/>
        </s:layout>
       
        <mx:TextArea width="100" height="100" errorString="Enter any value"
                                 change="textarea1_changeHandler(event)"
                                 />
        <s:Button label="Hello World"/>
</s:Application>

Thanks
ilikeflex


Reply | Threaded
Open this post in threaded view
|

Re: ErrorString and borderColor of controls not in sink

Alex Harui
Setting errorString only calls invalidateProperties.  Not sure why.  Did you try calling invalidateDisplayList as well?

From: ilikeflex <[hidden email]<mailto:[hidden email]>>
Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Date: Thursday, May 30, 2013 9:03 AM
To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
Subject: [flexcoders] ErrorString and borderColor of controls not in sink



Hi

When errorString of the component is any value(ex 'Enter the value') then the borderColor of the component changes to 'red'. But when you make the errorString="" it does not change the borderColor of the component back for the first time.

It change when the control lose focus.

How can we make the border color to original when using errorString="" for the first time even the control does not loose focus.

I have attached sample of the problem.

Any pointers..

<?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" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.utils.StringUtil;
protected function textarea1_changeHandler(event:Event):void
{
// TODO Auto-generated method stub
if (StringUtil.trim((event.target as TextArea).text).length == 0)
{
(event.target as TextArea).errorString = 'Enter any value';
}
else
{
(event.target as TextArea).errorString = "";
}
}
]]>
</fx:Script>

<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:layout>
<s:VerticalLayout/>
</s:layout>

<mx:TextArea width="100" height="100" errorString="Enter any value"
change="textarea1_changeHandler(event)"
/>
<s:Button label="Hello World"/>
</s:Application>

Thanks
ilikeflex



Reply | Threaded
Open this post in threaded view
|

Re: ErrorString and borderColor of controls not in sink

ilikeflex
Yes, but no luck. Any work around??

--- In [hidden email], Alex Harui <aharui@...> wrote:

>
> Setting errorString only calls invalidateProperties.  Not sure why.  Did you try calling invalidateDisplayList as well?
>
> From: ilikeflex <ilikeflex@...<mailto:ilikeflex@...>>
> Reply-To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
> Date: Thursday, May 30, 2013 9:03 AM
> To: "[hidden email]<mailto:[hidden email]>" <[hidden email]<mailto:[hidden email]>>
> Subject: [flexcoders] ErrorString and borderColor of controls not in sink
>
>
>
> Hi
>
> When errorString of the component is any value(ex 'Enter the value') then the borderColor of the component changes to 'red'. But when you make the errorString="" it does not change the borderColor of the component back for the first time.
>
> It change when the control lose focus.
>
> How can we make the border color to original when using errorString="" for the first time even the control does not loose focus.
>
> I have attached sample of the problem.
>
> Any pointers..
>
> <?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" minWidth="955" minHeight="600">
> <fx:Script>
> <![CDATA[
> import mx.utils.StringUtil;
> protected function textarea1_changeHandler(event:Event):void
> {
> // TODO Auto-generated method stub
> if (StringUtil.trim((event.target as TextArea).text).length == 0)
> {
> (event.target as TextArea).errorString = 'Enter any value';
> }
> else
> {
> (event.target as TextArea).errorString = "";
> }
> }
> ]]>
> </fx:Script>
>
> <fx:Declarations>
> <!-- Place non-visual elements (e.g., services, value objects) here -->
> </fx:Declarations>
> <s:layout>
> <s:VerticalLayout/>
> </s:layout>
>
> <mx:TextArea width="100" height="100" errorString="Enter any value"
> change="textarea1_changeHandler(event)"
> />
> <s:Button label="Hello World"/>
> </s:Application>
>
> Thanks
> ilikeflex
>


Reply | Threaded
Open this post in threaded view
|

Re: ErrorString and borderColor of controls not in sink

doug31415
In reply to this post by ilikeflex
Have you tried calling either textArea.invalidateProperties() or
textArea.invalidateDisplayList()? Im pretty sure that if you do that right
after you set the error string, it will reset the border color

Doug


On Thu, May 30, 2013 at 12:03 PM, ilikeflex <[hidden email]> wrote:

> **
>
>
> Hi
>
> When errorString of the component is any value(ex 'Enter the value') then
> the borderColor of the component changes to 'red'. But when you make the
> errorString="" it does not change the borderColor of the component back for
> the first time.
>
> It change when the control lose focus.
>
> How can we make the border color to original when using errorString="" for
> the first time even the control does not loose focus.
>
> I have attached sample of the problem.
>
> Any pointers..
>
> <?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" minWidth="955" minHeight="600">
> <fx:Script>
> <![CDATA[
> import mx.utils.StringUtil;
> protected function textarea1_changeHandler(event:Event):void
> {
> // TODO Auto-generated method stub
> if (StringUtil.trim((event.target as TextArea).text).length == 0)
> {
> (event.target as TextArea).errorString = 'Enter any value';
> }
> else
> {
> (event.target as TextArea).errorString = "";
> }
> }
> ]]>
> </fx:Script>
>
> <fx:Declarations>
> <!-- Place non-visual elements (e.g., services, value objects) here -->
> </fx:Declarations>
> <s:layout>
> <s:VerticalLayout/>
> </s:layout>
>
> <mx:TextArea width="100" height="100" errorString="Enter any value"
> change="textarea1_changeHandler(event)"
> />
> <s:Button label="Hello World"/>
> </s:Application>
>
> Thanks
> ilikeflex
>
>  
>