Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!mips!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Problem with MacApp ".Clone" Message-ID: <39178@apple.Apple.COM> Date: 4 Mar 90 23:14:20 GMT References: <1990Feb26.185646.21302@mathrt0.math.chalmers.se> Organization: Apple Computer Inc, Cupertino, CA Lines: 53 In article <1990Feb26.185646.21302@mathrt0.math.chalmers.se> d6caps@dtek.chalmers.se (Per Bergland) writes: > >I'm using MacApp 2.0b9. > >Question : > What's the meaning of making a method if you don't use it? > >I intended to use the Tobject.Clone method and relied on Apple having >made multiple instances where necessary (i.e. where fields are objects >or handles). It turned out this wasn't so. Why not? > >Problem examples: > >1) Cloning a TView doesn't clone the subviews. > >2) is what made me discover this. I cloned TCluster and got the > same text in both after changing one. Freeing also gave some > serious errors. It seemed the fDataHandle wasn't duplicated. > > >So, what? > >Am I supposed to change all MacApp-classes and create the Clone method >myself? (Mucho work :-( ) > > >Per Bergland >d6caps@dtek.chalmers.se Per, Anders Wallgren answered your concerns to some degree. I just wanted to mention that the MacApp team hasn't quite figured out just what cloning an object means. For instance, say you wanted to clone a TDialogView. Now, in a TDialogView, there are many references to other objects. There is fSuperView. Do you clone that? There is fSubViews, which is a TList. Do you clone that, or just copy it? How about all the objects contained in the TList. Do you clone them, or copy them? There is also the fNextHandler field. Clone, or copy? If you clone it, do you do a full clone, or a shallowclone? If you do a full clone, then you end up getting a duplicate copy of your entire event handler chaing. How about fTEView? Or fDocument? Or fPrintHandler? You see, there's a big can of worms that has to be dealt with here. Even if the MacApp team WERE to make a determination on what to do with those fields, it's not given that those determinations would hold for all applications. Perhaps someone would like to clone all the subviews, and yet another person would NOT like them cloned. -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions