apache-royale

Jewel textinput disable or readonly at runtime


How to set a jewel text input disable / readonly at runtime ? Why my code below not working? how to set up ?

<j:TextInput id="txtCode"> 
   <j:beads> 
      <j:TextPrompt  prompt="Project Code" id="promptCode" /> 
      <j:StringValidator required="5" autoTrim="false" 
         requiredFieldError="Need more than 5 characters"/>                                 
       <j:Disabled/>                                 
   </j:beads> 
</j:TextInput> 


private function btnAdd_click(event:MouseEvent):void    
{   
   txtCode.beads[2]=false; 
}

Thanks, Choirul


Solution

  • Yes you can. It is enough if you add bead [1] and start manipulate property "disabled" - true/false.

    [1] https://github.com/apache/royale-asjs/blob/develop/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/controls/Disabled.as

    Thanks, Piotr