Re: TreeView Tag and clone

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Steve Teeples (SteveTeeples_at_discussions.microsoft.com)
Date: 03/08/05


Date: Tue, 8 Mar 2005 08:09:10 -0800

I followed your suggestion and worked on this till quite late last night. I
now have routines that clone each object. I was fortunate that the arrays
within my objects use standard types so the clone() of the arrays went
smoothly. Again, thanks much!

"DalePres" wrote:

> If your object doesn't contain other reference types, you could just use
> object.Clone() on your object. But you will have to handle it from the
> lowest level of reference types and work up.
>
> DalePres
>
> "Steve Teeples" <SteveTeeples@discussions.microsoft.com> wrote in message
> news:F6B16CCB-667B-43F5-B14B-1EA63A6703E0@microsoft.com...
> > Thanks. I guess I'll need to create a routine that makes a copy of my
> > object.
> >
> > "DalePres" wrote:
> >
> >> Clone creates a shallow copy. The Tag property is of type object, a
> >> reference type. When you change the object pointed to by the reference,
> >> all
> >> references to that object see the changes. To change the object for your
> >> new TreeNode, create a new object and assign it to the Tag property of
> >> the
> >> new TreeNode.
> >>
> >> HTH
> >>
> >> DalePres
> >> MCAD, MCDBA, MCSE
> >>
> >>
> >>
> >> "Steve Teeples" <SteveTeeples@discussions.microsoft.com> wrote in message
> >> news:9D23CF0D-26B1-4F66-AC4A-166544885675@microsoft.com...
> >> >I have TreeNodes in a TreeView, each contains unique data in its Tag
> >> >section.
> >> > I am trying to 'clone' a TreeNode and then modify the tag data of the
> >> > cloned
> >> > TreeNode. What I am seeing is that by modifying the Tag data of the
> >> > cloned
> >> > TreeNode the original TreeNode's Tag data is also being modified with
> >> > the
> >> > identical change.
> >> >
> >> > Does the clone method not create a completely new data reference of the
> >> > original TreeNode? If not, how can I get a separate copy of the Tag
> >> > data?
> >> >
> >> > --
> >> > Steve
> >>
> >>
> >>
>
>
>



Relevant Pages

  • Re: newbie: capabilities of c++ in numerical computation
    ... >>1) Does object oriented programming introduce significant overhead as ... I personnaly think that arrays of doubles are better at low ... fortran or c library routines from your code. ... >>calling fftwlibraries? ...
    (comp.lang.cpp)
  • Re: Redoing Matlisp?
    ... Matlisp can use ATLAS routines which are ... Matlisp presents two different interfaces: ... In a similar way, we want to provide both interfaces, though we want to ... This is fast for large arrays but for small fixed-size arrays it may ...
    (comp.lang.lisp)
  • Re: problems with dup and clone...
    ... I have tried both dup and clone to copy the default objects but I always ... which reinitalised the instance arrays to and fix'ing the newly ... this program is a log scanner and I generate a class for each ...
    (comp.lang.ruby)
  • Defining variable type at runtime?
    ... I am working on merging two numerical codes which pretty much do the same. ... The main routine operates on a set of arrays which are of type real in one case and of type complex in another case. ... So a good part of code is the same, but some routines work slightly ... I try to adhere to the Fortran 95 style since gfortran supports it. ...
    (comp.lang.fortran)
  • Re: confusion of array clone() method
    ... you can find out what clone() does to arrays by adding an assertion: ... Java API. ...
    (comp.lang.java.programmer)