2 Replies Latest reply on Jun 3, 2011 1:51 AM by Peter Blazejewicz

    How to make a titlewindow's closebutton focusable?

    NeoRamza2

      How to make the closebutton of a titlewindows be fucusable?

       

      I tried this but still don't work:

       

      this.mx_internal::closeButton.focusEnabled = true;

       

      I need to the focus go to the closebutton using TAB.

       

       

      Somebody can help me?  Tanks.

        • 1. Re: How to make a titlewindow's closebutton focusable?
          Flex harUI Adobe Employee

          Which version of Flex and which titleWindow (MX or Spark)?

          • 2. Re: How to make a titlewindow's closebutton focusable?
            Peter Blazejewicz Level 4

            Hi,

             

            these look like dirty hacks but here you're:

             

            mx.containers.TitleWindow:

            override protected function createChildren():void

            {

                 super.createChildren();

                 if(mx_internal::closeButton)

                 {

                      mx_internal::closeButton.focusEnabled = true;

                 };

            };

            so in your custom title window  .mxml add above to your fx:Script code

             

            spark.controls.TitleWindow:

            override protected function partAdded(partName:String, instance:Object) : void

            {

                 super.partAdded(partName, instance);

                 if(instance == this.closeButton)

                 {

                      this.closeButton.focusEnabled = true;

                 }

            };

            again, add above to fx;Script section in your title window instance component .mxml

             

            I think that could be contrary to systems HIGs - if you provide just "Cancel" option to your window features (is this like form, settings window?) it will be focusable by default with TAB and can close window on itself.

             

            regards,

            Peter