Looks like that was the root of my problems. I think I need to get all this info sorted in my head, and write up an article on the finer points of container creation - there doesn't seem to be a lot of info out there on the web about custom container components.
Now, to debug the problem with overriding get numChildren! :D Is it a bad idea to create a builder project for the SDK source in order to enable "mark occurences"? That's a very useful builder feature when you're reading the framework code. -J On Tue, Jun 3, 2008 at 1:32 PM, Josh McDonald <[EMAIL PROTECTED]> wrote: > Yeah, I'm trying to get it working from Canvas, and then see how far up the > tree I can go while it still works. I've just now recompiled a bunch of > changes after doing much diving into the order of various events, methods, > and frame ticks. > > My main problem seems to have been not knowing about setActualSize() - I > couldn't for the life of me figure out how a component went from being > measured to having an actual width and height without setting explicitWidth > and explicitHeight and hence being taken out of the list for > invalidateSize().... > > If that were mentioned somewhere as a see-also in the docs for > UIComponent.width / height, UIComponent.invalidateSize() or > UIComponent.measure() things wouldn've been a lot easier (not to mention the > cursing). > > Hopefully switching to setActualSize() will turn on measure() all the way > down my tree, I've been trying all day to get a vbox added to my inner > Canvas via a state switch to be properly measured. > > -J > > > On Tue, Jun 3, 2008 at 1:16 PM, Alex Harui <[EMAIL PROTECTED]> wrote: > >> Don't know how to respond to this. If you need 80% of Canvas, derive >> from Canvas, otherwise derive from Container. Look at how we did Canvas and >> Panel to see how content and rawChildren are handled. Post a test case if >> there are still problems. >> >> >> ------------------------------ >> >> *From:* [email protected] [mailto:[EMAIL PROTECTED] *On >> Behalf Of *Josh McDonald >> *Sent:* Monday, June 02, 2008 4:50 PM >> *To:* [email protected] >> *Subject:* [flexcoders] The best way to subclass Container or Canvas? >> Children being measured as 0x0, various other issues >> >> >> >> Hey guys, >> >> I've got a component that extends Canvas (for borders etc), adds its own >> chrome using rawChildren.addChild, and overrides the other addChild / >> removeChild methods delegating them to an internal Canvas. This is extended >> by other developers to build MXML components. >> >> I'm having a whole bunch of problems with the contentCanvas and its >> children not measuring properly, and ignoring sizing I do give it. >> >> Also, if I override numChildren I get out-of-bounds exceptions somewhere >> in framework code that's called from a callLater, of which I have no idea >> where it's being dispatched or why it has an incorrect _firstChild >> >> What I'd like is to have the contentCanvas look after everything it >> contains, report a useful measuredWidth and measuredHeight so I can use them >> to measure my own component, but for it to still do as its told when I >> explicitly give it a width and height in updateDisplayList() >> >> Clearly I'm doing something seriously wrong, but I can't for the life of >> me figure out how I *should* be doing all this, so any pointers are >> definitely appreciated! >> >> I'd like to avoid extending UIComponent and re-implementing the hundred or >> so methods in IContainer, IRawChildren, IFocusManager, IChildList, etc etc >> etc only to have it not work becuase I've repeated the same mistake. >> >> -J >> >> -- >> "Therefore, send not to know For whom the bell tolls. It tolls for thee." >> >> :: Josh 'G-Funk' McDonald >> :: 0437 221 380 :: [EMAIL PROTECTED] >> >> > > > > -- > "Therefore, send not to know For whom the bell tolls. It tolls for thee." > > :: Josh 'G-Funk' McDonald > :: 0437 221 380 :: [EMAIL PROTECTED] > -- "Therefore, send not to know For whom the bell tolls. It tolls for thee." :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]

