1 Reply Latest reply on Oct 10, 2007 5:29 AM by

    Custom component that can accept children

      Hello,

      I'm quite new to Flex, and I'm beginning to develop custom components for my project. I'm facing a little problem...
      The component I'm writing now is called FormCanvas. It's a Canvas, in whitch I put a Label, a Form and buttons.
      Here is the MXML description:

      [code]
      <!-- File name: FormCanvas.mxml -->

      <mx:Canvas xmlns:mx=" http://www.adobe.com/2006/mxml" width="400" height="300">
      <mx:Label id="lblTitle" text="Label" top="10" left="10" right="10" textAlign="center" fontSize="14"/>
      <mx:Form id="dataForm" bottom="40" top="40" left="10" right="10" width="100%">
      </mx:Form>
      <mx:HBox horizontalAlign="center" verticalAlign="middle" left="10" right="10" bottom="10">
      <mx:Button label="Enregistrer" width="116" id="btnSave"/>
      <mx:Button label="Annuler" width="116" id="btnCancel"/>
      <mx:Button label="Fermer" width="116" id="btnClose"/>
      </mx:HBox>

      </mx:Canvas>
      [/code]

      Not very complex. Now I drop a FormCanvas component on my main window. It appears great, empty, with its buttons at bottom.
      Well now, I'd like to add TextInputs, Checkboxes, and RadioButtons in its Form object. When I drop them onto my FormCanvas component, it dosn't work.
      Do I have to override some methods to make my component automatically add children to its Form when I drop objects on it?

      Thanks in advance,

      Nico