How to integrate Connectors with User Scripting/Etoys?

Ned Konz ned at bike-nomad.com
Wed Aug 8 16:07:47 UTC 2001


I had the idea that my users could benefit by using User Scripting with my 
Connectors. I'd like to allow the connection of user scripts to the following 
events:

(any Morph)
connection added
connection removed

(ConnectorMorphs)
one end disconnected
one end connected

There are also some connection-related attributes that I'd like to make 
available to scripts:

(any Morph)
connections
(possibly incomingConnections, outgoingConnections if connections are viewed 
as being directed in some way)

(ConnectorMorphs)
fromMorph
toMorph

I have some questions (note that I'm still kinda vague on the connection 
between EToys and user scripting in general):

* First, the events that are able to activate a script seem to be limited in 
ScriptInstantiation, both in the menu provided in presentScriptStatusPopup 
and in status: . There appears to be no way to extend these other than 
editing ScriptInstantiation.

* There is no way (apparent to me) to use a different (extended) version of 
ScriptInstantiation, because its name is hard-wired in 
Player>>scriptInstantiationForSelector: . I don't know enough about the 
scripting system to know whether subclasses of Player would make any sense 
here (the class name Player is also hard-coded in several places). How would 
one go about extending the events that could trigger a script?

* Collections seem to be awkward in the eToy world. I've only found the 
Playfield 'collection' protocol so far, which uses a (single?) cursor for 
access to a collection. Doesn't the existence of a single cursor get in the 
way if there are multiple clients of a collection? How should I present the 
collection of connections to a Morph? I could see a user script wanting to 
enumerate over all the connections to a Morph.

Or would this be done best in the textual mode? I suppose methods could be 
added to Player to allow enumeration of connections.

* It doesn't appear that arguments are sent to scripts on events. This makes 
sense when there are queries for the attributes of the events (like mouse 
position, etc.). But what would be the best way to find out inside a script 
what connection was just connected (assuming an event of connectionAdded)? I 
suppose I could have an attribute called lastConnectionAdded.

Sorry if this doesn't seem too coherent. I'm trying to put together a system 
where the standard Smalltalk programming tools aren't available (I can't 
imagine having to do tech support on them), but is still programmable in some 
sense.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list