Removing observers
-
How do you remove observers? What is the argument to pass on?
I've been using an entities observer to monitor the enitites of the active path. Whenever the path changes I need to remove the observers watchign the old path. But now?
http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#remove_observer
The example in the manual doesn't give much of a clue. Just says observers. I tried passing my Observer class, but that didn't do anything. The remove_observer method return false every time. -
@tig said:
http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#remove_observer ?
That would be the same link I provided in my OP. It's not obvious to me what it does and what the
observer
is.I've tried to make store the return value when I do MyEntitiesObserver.new (
myTemp = MyEntitiesObserver.new
)And then I try
entities.remove_observer( myTemp )
and that returns true. But the old observers still triggers... -
http://code.google.com/apis/sketchup/docs/ourdoc/entities.html#remove_observer ?
You need to pass the observer to the 'remove_'... You must have an entity_ or entities_observer ?
-
Ok. Found the problem. I was using
model.active_path
to cache the last path. When the last path was themodel
itself it'd return an empty array.
Advertisement