5 Replies Latest reply on Oct 23, 2009 8:10 PM by jdesko

    Spark TitleWindow showCloseButton?

    jdesko Level 2

      In the new Spark TitleWindow how can you programmatically show/not show the close button?  I don't see the showCloseButton as was in Halo.  In the skin I can set visible = false, but for a global custom component this won't work.

       

      Thanks,

      John

        • 1. Re: Spark TitleWindow showCloseButton?
          Peter deHaan Level 4

          @jdesko,

           

          Good question. I filed this a couple hours ago: http://bugs.adobe.com/jira/browse/SDK-23808 (feel free to vote and/or comment and/or attach your use case).

           

          My guess is that it isn't really a bug since the close button is an optional skin part, so the preferred method would be to create a custom skin without the close button and then you could globally style all TitleWindows to not display the close button by using CSS like s|TitleWindow { skinClass: ClassReference("ButtonlessTitleWindow");}

           

          Peter

          • 2. Re: Spark TitleWindow showCloseButton?
            jdesko Level 2

            Hello Peter;

             

            Thanks for the reply.  After reading the bug report that you filed you answered my question, the simple solution for my case was ...

             

            I have a custom MXML component based on Spark TitleWindow with a  custom TitleWindowSkin skinclass (the skinclass was for cosmetics only not necessary for this solution).  But the simple solution was to set the closebutton.visible  = false.  So in my script block when I instantiate my component if I don't need the closebutton ... example

             

            private var titleWindow:myTitleWindow

            titleWindow = myTitleWindow(PopUpManager.createPopUp(this, myTitleWindow, true));

            titleWindow.closeButton.visible = false;

             

            So just as simple as Halo's showCloseButton.

             

            Thanks again and thanks for your blog, my daily go to reading material.

             

            John

            • 3. Re: Spark TitleWindow showCloseButton?
              Peter deHaan Level 4

              If you already have a custom skin, why not remove the close button in the skin?

              I think it's like line 225-227 in the default TitleWindowSkin class (depending on your build it may be slightly different):

               

              <!-- close button -->
              <s:Button id="closeButton" skinClass="spark.skins.spark.TitleWindowCloseButtonSkin"
                        width="15" height="15" right="2" top="3" />

               

               

              Or you could even just hide it using the skin's creationComplete event:

               

              <s:SparkSkin ... creationComplete="closeButton.visible = false;">

               

               

              Peter

              • 4. Re: Spark TitleWindow showCloseButton?
                jdesko Level 2

                Hello Peter;

                 

                The custom component based on TitleWindow is multipurpose, sometimes I need the closeButton sometimes not, so that is why I did not remove it from the skin.  In reference to creationComplete, I instantiate this component in a script block used in conjuction with PopUpManager so that's where I set the closeButton.visible = false if I don't need it (as shown in previous example).  If I did use MXML for a Sparks TitleWindow, yes I can use creationComplete.

                 

                Right now I'm trying to figure out how to style the closeButton, change the color of the X, the TitleWindowCloseButton skin show's that symbolColor can be styled (it uses an array), but my style in a separate CSS file isn't working

                 

                myTitleWindow #titleDisplay {

                     fontSize: 14;

                     color: #ffffff;

                     symbolColor: #ffffff, #ffffff;

                }

                 

                The other thing that I'm trying to figure out is I originally created this component based on Sparks Panel and in my external style file I set the fontSize and color for Sparks Panel; now that I changed my component to a Sparks TitleWindow it is still picking up the style from Panel.

                 

                John

                • 5. Re: Spark TitleWindow showCloseButton?
                  jdesko Level 2

                  This didn't have to do with the original post, but because my last entry I mentioned that I had a problem styling the Sparks TitleWindow titleDisplay...

                   

                  For some reason after changing my custom component based on Sparks Panel to based on Sparks TitleWindow the TitleWindow titleDisplay was somehow picking up the CSS style (external stylesheet) from the global style for Sparks Panel titleDisplay (?).  So for times sake to remedy in a TitleWindow custom skin I set the styles I wanted (font size and color) by setting the properties in label in the titleDisplay section.

                   

                  For styling the closeButton (color of the X) again a style sheet wasn't working so I created a custom TitleWindowCloseButton skin, I commented out the script section which was setting exclusions for the xColor, and then I set the color for xFill1 and xFill2.