Pete Carss <[EMAIL PROTECTED]> wrote

> Its also very difficult 
> for us lingo OOP people because we only have half an OOP environment. If 
> you want to make a subclass of a text box so that you don't have to 
> re-invent the textbox wheel, but you want to add a few funky methods of 
> your own...Where do you go?

... or a subclass of a digital video movie that sends messages to a
dedicated slider regularly... OK, we can do something like that with a
behavior, which is fine as long as you are thinking of sprites all the time,
but I still miss the ability to create our own subtypes of cast members. 

You can (of course) set an ancestor to one of Director's own object types,
such as member, list or rect. Alas, cast members do not inherit the
properties and handlers of cast member scripts (stupid stupid stupid), so
using a member as an ancestor is not very useful. Even so, try this:

-- script xyz
property ancestor

on new me, str

  f = new(#field)
  f.text = str
  ancestor = f
  return me

end

on doit me
  put me.text
end


-- message window code follows:
a = new(script "xyz", "test")
a.doit()
-- "test"



BTW, One of the best ways to avoid 'get' functions is to use callbacks. An
object asks another object to call him when she's done with his task, then
goes into some kind of waiting state. In some cases, such as with timeout
objects, the callback itself is the service provided, but usually you'd want
a little more.

Check out these hypothetical examples:

Example 1;

ObjectA updates itself every frame with data it gets from ObjectB by calling
ObjectB's getData() function.


Example 2;

ObjectA registers itself for callbacks with ObjectB. Every frame, ObjectB
sends a message to the callback handler of ObjectA with some data as a parameter.


If ObjectA is the slider, and ObjectB is a wrapper behavior for a Quicktime
sprite, then we have an opaque implementation in Example 2. Example 1 would
work, but there's data being sneaked out of ObjectB, whose role is more that
of 'sloppy gatekeeper' which makes me wonder why ObjectA doesn't just poll
the Quicktime sprite directly.


Can anyone suggest a thorny example - from a real world project perhaps -
which absolutely could not be implemented without 'get' functions?


-- 
_____________

Brennan

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to