New topic: Copy StringShape does not make a real copy (Solved)
<http://forums.realsoftware.com/viewtopic.php?t=41304> Page 1 of 1 [ 3 posts ] Previous topic | Next topic AuthorMessagepeterthisted Post subject: Copy StringShape does not make a real copy (Solved)Posted: Fri Nov 04, 2011 3:57 am Joined: Mon Aug 14, 2006 7:12 am Posts: 73 I have a defined a new string shape and named it myStringShape The color is set to White Defining a new Stringshape as a copy of the first one Code:dim myStringShape2 as new StringShape myStringShape2 = myStringShape myStringShape2.color = rgb(0,0,0) //Black But that changes color of the first one as well ??? Re Peter Last edited by peterthisted on Fri Nov 04, 2011 4:26 am, edited 1 time in total. Top timhare Post subject: Re: Copy StringShape does not make a real copyPosted: Fri Nov 04, 2011 4:18 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 10375 Location: Portland, OR USA That does not make a copy, it just creates a reference to the same object. There is no way that I am aware of to make a copy of an object2d. You just have to create a new one and copy all the properties one at a time. Top peterthisted Post subject: Re: Copy StringShape does not make a real copyPosted: Fri Nov 04, 2011 4:25 am Joined: Mon Aug 14, 2006 7:12 am Posts: 73 Ok ! I have my definition of the StringShape in a Method already so it was just a matter of adding a color property to the method and then reusing it. But it makes no sense that a copy should not be a unique copy with its own properties inside. Anyway, problem solved, thanks again timhare Re Peter Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
