add a listener to a class
3 ビュー (過去 30 日間)
古いコメントを表示
hi all! so: suppose I have a class1, containing a property that is defined as a list of another class2, that has also another class3 inside. This is my object. Now suppose that I change a property value of the class3 (the last one in the tree). Or also to change a value in class2. Is it possible to have only a listener attached to class1 that is able to understand that something changed somewhere in my object? without put listeners for each property of the 3 classes? thank you, marco
0 件のコメント
回答 (1 件)
Daniel Shub
2011 年 7 月 19 日
If you can modify class2 and class3, then you can modify those classes to issue an event SomethingChanged, whenever a property value is set. Then class1 could listen for a single event. You could probably even include what changed in the eventdata of SomethingChanged.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Events についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!