Xojo Conferences
XDCMay2019MiamiUSA

RE: Object2D/Group2D: append vs. "copy (Real Studio network user group Mailinglist archive)

Back to the thread list
Previous thread: [ANN] Base64
Next thread: does RB 4 work under Jaguar?


Editfields: Automatically enable copy/paste/cut   -   Jan Erik Moström <
  RE: Object2D/Group2D: append vs. "copy   -   Stys, Peter
   Re: Object2D/Group2D: append vs. "copy   -   Will Leshner
    RE: Object2D/Group2D: append vs. "copy   -   Stys, Peter

RE: Object2D/Group2D: append vs. "copy
Date: 09.08.02 17:09 (Fri, 9 Aug 2002 12:09:28 -0400 )
From: Stys, Peter
So am I! Here's what I was doing:

dim c as curveShape dim d as Group2D
d= new Group2D c = new curveShape // all I need is one curveShape object, right? Wrong!
// define a line c.X = 0 c.Y = 100 c.X2 = 50
c.Y2 = 200 d.append c // save my line to the Group2D (thinking, incorrectly, it was
"copied")

// now create a new line
c.X = 10
c.Y = 300
c.X2 = 70
c.Y2 = 400
d.append c // append this new line to the group

etc...etc...

now:
g.drawobject d,0,0 // draws only the last line

According to Joe (thx BTW), what I need to do is precede each new line
definition with:
c = new curveShape

I guess because of the previous .append, the previous c info was correctly
referenced and "saved" into the Group2D, and I can now do a 'new curveShape'
back into c without losing the previous line.

Now do I understand? Maybe...

Peter.

-----------------------------------------------------------
Peter K. Stys, MD e-mail: <email address removed>
Professor of Medicine tel: (613)761-5444
Ottawa Health Res. Inst. fax: (613)761-5330
Div. of Neuroscience
Ottawa Hosp./ Univ of Ottawa
Ontario, CANADA
http://www.ohri.ca/profiles/stys.asp
-----------------------------------------------------------

> ----------
> From: Will Leshner
> Reply To: REALbasic Network Users Group
> Sent: Friday, August 9, 2002 8:51 AM
> To: REALbasic Network Users Group
> Subject: Re: Object2D/Group2D: append vs. "copy"; also how to
> rotate/scale ?
>
> OK. I'm really confused now. Why do you say that Group2d won't store the
> objects for you. It will. Just put them in there and forget about them.
> Look at it this way, at the point where you are about to put them in
> your array you have a new Object2D, right. So instead of putting that
> object in the array, put it in the Group2D instead.
>
> In other words, let's say you are storing objects in an array. Are you
> doing something like this:
>
> dim o as Object2D
>
> o = new Object2D
> myarray.append o
>
> So why don't you do something like this instead:
>
> dim o as Object2D
> o = new Object2D
> mygroup2d.append o
>
> What is the difference?
>
> On Friday, August 9, 2002, at 08:41 AM, Stys, Peter wrote:
>
> > That's if you know beforehand how many shapes you need to draw.
> > Otherwise a dynamically resizeable array is the only way. Bottom line
> > is
> > you have to store them yourself somewhere; Group2D won't do it for you,
> > but
> > it would be convenient if it did.
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

Re: Object2D/Group2D: append vs. "copy
Date: 09.08.02 17:23 (Fri, 9 Aug 2002 09:23:56 -0700)
From: Will Leshner
That's not a new line, that's the old one with new values. Note that if
you had tried to implement this with arrays you would have had the same
problem. In other words, if you had made "line" c and appended it to an
array, then changed c and appended it again, you would have had the same
c in the array twice and you would have clobbered its initial values
with the new values.

The only way to have two lines is to use "new" twice.

On Friday, August 9, 2002, at 09:09 AM, Stys, Peter wrote:

>
> // now create a new line
> c.X = 10
> c.Y = 300
> c.X2 = 70
> c.Y2 = 400
> d.append c // append this new line to the group

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>

RE: Object2D/Group2D: append vs. "copy
Date: 09.08.02 17:34 (Fri, 9 Aug 2002 12:34:59 -0400 )
From: Stys, Peter
yes that was my mistake. BTW, the scale property is very useful, BUT it
appears to work in XY by the same factor. Is there no way to scale in X by
a different factor than in Y? That would be much more useful.

P.

-----------------------------------------------------------
Peter K. Stys, MD e-mail: <email address removed>
Professor of Medicine tel: (613)761-5444
Ottawa Health Res. Inst. fax: (613)761-5330
Div. of Neuroscience
Ottawa Hosp./ Univ of Ottawa
Ontario, CANADA
http://www.ohri.ca/profiles/stys.asp
-----------------------------------------------------------

> ----------
> From: Will Leshner
> Reply To: REALbasic Network Users Group
> Sent: Friday, August 9, 2002 9:23 AM
> To: REALbasic Network Users Group
> Subject: Re: Object2D/Group2D: append vs. "copy
>
> That's not a new line, that's the old one with new values. Note that if
> you had tried to implement this with arrays you would have had the same
> problem. In other words, if you had made "line" c and appended it to an
> array, then changed c and appended it again, you would have had the same
> c in the array twice and you would have clobbered its initial values
> with the new values.
>
> The only way to have two lines is to use "new" twice.
>
> On Friday, August 9, 2002, at 09:09 AM, Stys, Peter wrote:
>
> >
> > // now create a new line
> > c.X = 10
> > c.Y = 300
> > c.X2 = 70
> > c.Y2 = 400
> > d.append c // append this new line to the group
>
> ---
> Subscribe to the digest:
> <mailto:<email address removed>>
> Unsubscribe:
> <mailto:<email address removed>>

---
Subscribe to the digest:
<mailto:<email address removed>>
Unsubscribe:
<mailto:<email address removed>>