3 Replies Latest reply on Nov 4, 2009 5:32 PM by Flex harUI

    issue withTextInput in custom Panel header

    hongyu_sj

      Hi,

      I have to extends flex Panel for my project. In the custom panel header, I added a TextInput. It displayed OK, but when I put focus on it, the focus highlight displayed in another position. Here is the code:

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

       

      public class SubscriptionPanel extends

      Panel

       

       

      {

       

       

       

       

       

       

       

       

      private var _phoneNumber:TextInput = new

      TextInput();

       

       

       

       

       

       

       

       

       

       

      private var _selectLookup:Label = new

      Label();

       

       

       

       

       

       

       

       

       

       

      private var _lookupable:Boolean = false

      ;

       

       

       

       

       

       

       

       

       

       

       

      public function

      SubscriptionPanel()

       

       

      {

       

       

       

       

       

       

       

       

      super

      ();

       

       

      }

       

       

       

       

       

       

       

       

      public function set lookupable(value:Boolean):

      void

       

       

       

       

      {

      _lookupable = value;

      }

       

       

       

       

       

       

       

       

      override protected function createChildren():

      void

       

       

       

       

      {

       

       

       

       

       

       

       

       

      if(this.getChildren() != null

      )

       

       

       

       

       

       

       

       

       

       

      this

      .removeAllChildren();

       

       

       

       

       

       

       

       

       

       

       

      super

      .createChildren();

       

       

      _phoneNumber.width = 100;

      _phoneNumber.height = 22;

      _phoneNumber.includeInLayout =

       

       

       

       

       

       

       

      true

      ;

       

       

      _selectLookup.width = 50;

      _selectLookup.height = 22;

      _selectLookup.text = resourceManager.getString(

       

       

       

       

       

       

       

      'RIMResources', 'SubscriptionPanel_select'

      );

       

       

      _selectLookup.setStyle(

       

       

       

       

       

       

       

      "textDecoration", "underline"

      );

       

       

      _selectLookup.includeInLayout =

       

       

       

       

       

       

       

      true

      ;

       

       

       

       

       

       

       

       

       

       

      if

      (_lookupable)

       

       

      _selectLookup.addEventListener(MouseEvent.CLICK, onClickSelectPhoneNumber,

       

       

       

       

       

       

       

      false, 0, true

      );

       

       

      rawChildren.addChild(_phoneNumber);

      rawChildren.addChild(_selectLookup);

      }

       

       

       

       

       

       

       

       

      override protected function updateDisplayList(w:Number, h:Number):

      void

       

       

       

       

      {

       

       

       

       

       

       

       

       

      super

      .updateDisplayList(w, h);

       

       

       

       

       

       

       

       

       

       

       

      if

      (w > 0 && h > 0)

       

       

      {

      _phoneNumber.x = 10;

      _phoneNumber.y = 5;

       

      _selectLookup.x = 120;

      _selectLookup.y = 5;

       

       

       

       

       

       

       

       

       

      if

      (_lookupable)

       

       

      {

      _phoneNumber.enabled =

       

       

       

       

       

       

       

      true

      ;

       

       

      _selectLookup.enabled =

       

       

       

       

       

       

       

      true

      ;

       

       

      _phoneNumber.setStyle(

       

       

       

       

       

       

       

      "styleName", "TextInputMandatory"

      );

       

       

      }

       

       

       

       

       

       

       

      else

       

       

       

       

      {

      _phoneNumber.enabled =

       

       

       

       

       

       

       

      false

      ;

       

       

      _selectLookup.enabled =

       

       

       

       

       

       

       

      false

      ;

       

       

      _phoneNumber.setStyle(

       

       

       

       

       

       

       

      "styleName", "TextInputReadOnly"

      );

       

       

      }

      }

      }

       

       

       

       

       

       

       

       

      private function onClickSelectPhoneNumber(event:Event):

      void

       

       

       

       

      {

       

       

       

       

       

       

       

       

      var selectPhoneNumber:SelectPhoneNumber = new

      SelectPhoneNumber();

       

       

       

      PopUpManager.addPopUp(selectPhoneNumber, Sprite(Application.application),

       

       

       

       

       

       

       

      true

      );

       

       

      The screenshot is in the attachment. Thanks!

       

      Hong