5 Replies Latest reply on Dec 21, 2010 4:09 AM by asbestos girl

    spark Panel header?

    kss587 Level 1

      is there a option to remove the header of the spark panel..similar to the one in flex3 where we set <mx:panel headerHeight=0 />

        • 1. Re: spark Panel header?
          TeotiGraphix Level 3

          Hi,

           

          Without having to copy the almost 300 lines of PanelSkin code to do this you could try.

           

          <?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">
              <fx:Script>
                  <![CDATA[
                      
                      import mx.events.FlexEvent;
                      import spark.skins.spark.PanelSkin;
          
                      protected function panel_creationCompleteHandler(event:FlexEvent):void
                      {
                          var skin:PanelSkin = panel.skin as PanelSkin;
                          skin.topGroup.includeInLayout = false;
                          skin.topGroup.visible = false;
                      }
          
                  ]]>
              </fx:Script>
              
              <s:Panel id="panel" 
                       title="Not going to see ME!"
                       creationComplete="panel_creationCompleteHandler(event)">
                  <s:List/>
              </s:Panel>
              
          </s:Application>
          


          Depending on your needs, you may just create a simple subclass that implements the topGroup hidding.

           

          Mike

          1 person found this helpful
          • 2. Re: spark Panel header?
            kss587 Level 1

            Hi Mike,

            The solution you gave is much simpler.

            Thank you so much. But the problem is that the spark panel i have is the root tag of a mxml component.then how do i get the reference ?

            But now i am  using a skin class with this line of code.

             

            <s:Group

             

            id="padding" width="100%" height="100%">

             

             

            <s:Group id="contentGroup" top="0" left="0" right="0" bottom="0" minWidth="0" minHeight="0">

             

             

            </s:Group>

             

            This  renders the header invisible.But i would still like to proceed with your approach. How do i get the reference for such root tags?

            • 3. Re: spark Panel header?
              TeotiGraphix Level 3
              <?xml version="1.0" encoding="utf-8"?>
              <s:Panel xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx"
                      
              creationComplete="panel_creationCompleteHandler(event)"

                  <fx:Script>
                      <![CDATA[
                         
                          import mx.events.FlexEvent;
                          import spark.skins.spark.PanelSkin;

                          protected function panel_creationCompleteHandler(event:FlexEvent):void
                          {
                              var skin:PanelSkin = skin as PanelSkin;
                              skin.topGroup.includeInLayout = false;
                              skin.topGroup.visible = false;
                          }

                      ]]>
                  </fx:Script>
                 
              </s:
              Panel>

               

              This is how you would do the same thing a a Panel MXML component.

               

              Mike

              • 4. Re: spark Panel header?
                David_F57 Level 5

                hi,

                 

                If your happy just to hide the header at run time....

                 

                 

                <s:Panel id="pnl" x="90" y="116" width="250" height="200" creationComplete="pnl.titleDisplay.height=pnl.titleDisplay.minHeight=0" >

                 

                 

                David.

                 

                [edit] do you need to use a panel, there is always borderContainer.

                1 person found this helpful
                • 5. Re: spark Panel header?
                  asbestos girl

                  Thank you, I had the same issue and simply changing to s:BorderContainer did the trick in the simplest way.