Duplication Through Siblings

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Duplication Through Siblings

Thompson, Ryan
Welcome to the "Squeakland" mailing list (Digest mode)
Good morning,
 
I have set up squeak to create siblings or duplicates through a script which is activated via a button. However, not only does it create copies of the objects but it also puts a copy on my cursor. How can I eliminate this pesky copy?
 
Regards,
 
Ryan Thompson

_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Duplication Through Siblings

Scott Wallace
Re: [Squeakland] Duplication Through Siblings
Hi, Ryan,

Please send us a copy of your project, or at least a picture of the Scriptor containing the script that is misbehaving, so that we can track down the problem.

Cheers,

  -- Scott

At 10:22 AM -0500 2/25/06, Thompson, Ryan wrote:

Good morning,
 
I have set up squeak to create siblings or duplicates through a script which is activated via a button. However, not only does it create copies of the objects but it also puts a copy on my cursor. How can I eliminate this pesky copy?
 
Regards,
 
Ryan Thompson

_______________________________________________
Squeakland mailing list
[hidden email]
http://squeakland.org/mailman/listinfo/squeakland
Reply | Threaded
Open this post in threaded view
|

Re: Duplication Through Siblings

Scott Wallace
In reply to this post by Thompson, Ryan
Re: [Squeakland] Duplication Through Siblings
Hi, Ryan, and all,

[Ryan privately emailed me a copy of his project, on which this reply is based.]

The reason why you're getting an extra copy stuck to your cursor is because of this script, which in your project is used for making the copies:


"Cell8's copy" *already* makes a copy.  Telling *that* copy to "do menu item 'duplicate'" means:  do the same thing as if I were actually to have chosen the "duplicate" menu item from the halo menu of the first copy.

... which makes a copy (of the initial copy) and puts it on your cursor.  Precisely the phenomenon you're observing ;-)

So, in short, that single phrase in the "duplicate" script makes *two* copies, leaving one on your cursor.


The best idiom to use to make copies using scripts is to invoke "copy" to get the copy, and to use "include at end" or another of the "include" options to say *where* the copy should be put.

Thus, for example, here's a nice script which tells a cell to make a copy of itself and add to it to a container named Holder:


I'm attaching a reworked version of Ryan's "cell" project that makes use of this idiom.  Note also that this version puts the cells into a "holder" rather than into a simple "playfield," in order to make the results of each doubling of the cell population be more visually apparent.

Cheers,

 -- Scott


At 10:22 AM -0500 2/25/06, Thompson, Ryan wrote:

Good morning,
 
I have set up squeak to create siblings or duplicates through a script which is activated via a button. However, not only does it create copies of the objects but it also puts a copy on my cursor. How can I eliminate this pesky copy?
 
Regards,
 
Ryan Thompson