Thanks a lot Jester, I'm trying to follow your suggestions but I haven't delved much yet in creating components with AS. Is there a way to set the border metrics of a container inside the custom component? I'd like to set a VBox to always have a 10 pixel padding. Not sure how do to that in AS and the borderMetrics property is read-only!
Thanks, Sascha > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of JesterXL > Sent: Tuesday, 11. July, 2006 04:55 > To: [email protected] > Subject: Re: [flexcoders] Custom Window Component - Is this possible? > > 2 things. > > First, you cannot put stuff in a Container based component that already has > stuff in it via MXML. You can via ActionScript. > > So, write your EditorWindow in ActionScript, and you'll be fine. > > Second, make the default width and height of it 400 width, and 300 height, > not 100%. Percentage widths can do unexpected things. As a component > developer, you should give it a reasonable size, and let the peeps using it > dictate the size. > > So... > > package > { > import mx.containers.TitleWindow; > > public class EditorWindow extends TitleWindow > { > // you're goodness here > } > } > > Then, you can use the code you were doing, like: > > <?xml version="1.0" encoding="utf-8"?> > <EditorWindow xmlns="gui.parts.*" > xmlns:mx="http://www.adobe.com/2006/mxml" > width="400" height="300" xmlns:ns1="gui.parts.*"> > </EditorWindow> > > If she doesn't work out for you, post back here and we'll help you out. > > > ----- Original Message ----- > From: "Sascha Balkau" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Monday, July 10, 2006 1:40 PM > Subject: [flexcoders] Custom Window Component - Is this possible? > > > I'm trying to create a custom component in Flex2 based on TitleWindow that > should be the base for a couple of windows that all have more or less > different controls but also have several parts in common like an 'Ok' and a > 'Cancel' Button that are at the bottom of every window. > > I've created a component named EditorWindow which is the base for all the > other windows. Here's a simple mxml of it ... > > <?xml version="1.0" encoding="utf-8"?> > <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" > layout="absolute" > width="100%" height="100%" showCloseButton="true"> > <mx:VBox left="10" right="10" top="10" bottom="10"> > <mx:HBox width="100%" height="100%"> > </mx:HBox> > <mx:HRule width="100%"/> > <mx:HBox width="100%"> > <mx:Button label="OK" width="60"/> > <mx:Button label="Cancel" width="60"/> > </mx:HBox> > </mx:VBox> > </mx:TitleWindow> > > And a window class that is based on this component would naturally look like > this ... > > <?xml version="1.0" encoding="utf-8"?> > <EditorWindow xmlns="gui.parts.*" > xmlns:mx="http://www.adobe.com/2006/mxml" > width="400" height="300" xmlns:ns1="gui.parts.*"> > </EditorWindow> > > Ideally the varying controls of every inheriting Window should go into the > empty HBox above the HRule and the two buttons at the bottom but if I create > a window based on this and try to drag a component into the place it will > not insert any component code. If I manually write the component code > between the <EditorWindow> tags it will fill out the whole window and > ignores the boundaries of the HRule and the two buttons. Does somebody know > if it possible to get this working differently? > > Thanks for any advice! > Sascha > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Check out the new improvements in Yahoo! Groups email. http://us.click.yahoo.com/6pRQfA/fOaOAA/yQLSAA/nhFolB/TM --------------------------------------------------------------------~-> -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

