5 Replies Latest reply on Mar 1, 2007 3:15 AM by batmitra

    Panel, title window buttons

    batmitra Level 1
      Hi everybody

      I wonder, i know its possible to add buttons, to the titlebar of a title window, but i don't know how its done, can someone explain me please? or send me a link with a tutorial. Also i'd like to know if its possible to add another type of controls such as input text or combobox.

        • 1. Re: Panel, title window buttons
          peterent Level 2
          Our TitleWindow (and Panel) do not support child components in the title area. It is possible to write a skin to do it, extending UIComponent instead of BorderSkin, but it is tedious.

          The easiest way is to create a custom component that extends Canvas and first put in a TitleWindow and then place other controls on top of the TitleWindow exactly where you want them. I'd recommend attaching the TitleWindow to the left, top, bottom, and right sides of the Canvas and attaching the additional controls to the top and right sides only. This will allow the TitleWindow and controls to position themselves as the Canvas grows.

          You can then adapt this blog article: http://weblogs.macromedia.com/pent/archives/2006/03/component_templ.cfm to your needs.
          • 2. Re: Panel, title window buttons
            batmitra Level 1
            thanks for your answer but i'm a newbie on building custom components, so could you please be kind to show me how its done?


            P.S - I love your blog
            • 3. Re: Panel, title window buttons
              peterent Level 2
              Open Flex Builder and go into Design Mode. Draw a Canvas container to the stage. Then drag a Panel into the Canvas. Then drag any other control, say a Button, into the Canvas and position it above the Panel's title area.

              That's really all you need to do.
              • 4. Re: Panel, title window buttons
                ctzn99 Level 1
                Here's a sample I've created, it just so happens I'm currently working on something similiar.

                <?xml version="1.0" encoding="utf-8"?>
                <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="400" height="300">
                <mx:XML id="cmbXML">
                <item label="item one" />
                <item label="item two" />
                <mx:TitleWindow width="100%" height="100%" layout="absolute" title="Title Window Test">
                <mx:Button label="Button" right="10" bottom="10"/>
                <mx:Button label="Button" right="83" bottom="10"/>
                <mx:TextArea left="10" right="10" top="10" bottom="40"/>
                <mx:Image source="images/common/cross.png" right="10" top="6"/>
                <mx:ComboBox right="40" y="4" dataProvider="{cmbXML.item}" labelField="@label" />

                The only challenge is, as a popup window I can't drag it around, i have to let the mouse drag event fall through to the canvas somehow.
                • 5. Re: Panel, title window buttons
                  batmitra Level 1
                  Thank you very much for your answers, now i understand how it is done, my problem was that when i dragged a control to the titlewindow titlebar it would dissapear but i figured it out, flexbuilder was putting it inside the titlewindow tag, so it must be written by hand to make it stay on top of the window.

                  Thanks again