[Squeakland] 1 script -> N objs

Ned Konz ned at bike-nomad.com
Tue Feb 22 22:25:34 PST 2005


On Tuesday 22 February 2005 6:54 pm, you wrote:
> However, what I'm looking for is a simple way to execute a
> single script and have it act on N (sibling) objects (where N can be
> large).

There are several methods that communicate with all the siblings of a given 
object.

 scripting
  command 'pause all' scriptName(ScriptName) make the given script be "paused" 
in the object and all of its siblings
  command 'start all' scriptName(ScriptName) start the given script ticking in 
the object and all of its siblings.
  command 'stop all' scriptName(ScriptName) make the given script be "normal" 
in the object and all of its siblings
  command 'tell all siblings' aMessageSelector(ScriptName) send a message to 
all siblings
  command 'send to all' aMessageSelector(ScriptName) run the given script in 
the object and in all of its siblings

> Related, is the "proper" way to easily generate N sibling
> objects to create a script with misc: Sketch look like Sketch's copy ?

the 'copy' property will return a sibling if the object was scripted or had an 
instance variable.

So you could do something like

 MasterObject's holder addAtEnd: MasterObject's copy

to add a single object.
-- 
Ned Konz
http://bike-nomad.com



More information about the Squeakland mailing list