eInstance_Watch

Module: ecereCOM
Namespace: ecere::com

dllexport void eInstance_Watch(Instance instance, Property _property, void * object, void(*)(void *, void *))

Description

watch allows one object to watch some property of another object, allowing it to react when that property changes.

Parameters

instance  Instance  (null) 
_property  Property  (null) 
object  void *  (null) 
callback  void(*)(void *, void *)  (null) 

Usage


In classA, add "watchable" to the property to be watched.
In classB, add "watch classA { propertyA { DoStuffHere() } propertyB { DoStuffHere() } delete { DoStuffWhenClassADeleted() };

Example

class Foo
{
int box;
property int box { watchable set { box = value; } get { return box; } };
}

class Bar
{
watch foo { box { PrintLn(“box changed!”); } delete { PrintLn(“foo is gone!”); } };
}

Foo foo {};
Bar bar {};

See Also


eInstance_WatchDestruction(), eInstance_StopWatching(), eProperty_Watchable()