Why do the function must pass event.EventData object

3 次查看(过去 30 天)
I found event.EventData object must be pass between notify and callbackFunction
The document give an example code use event.EventData object "evtdata"
evtdata = ToggleEventData(newState);
notify(obj,'ToggledState',evtdata);
evtdata is a ToggleEventData's object! I think pass 'evtdata' between notify and callbackFunction is enough.It seems unnecessary to pass 'ToggledState'.
I think both notify and callbackFunction should know evtdata is a ToggleEventData class object!After all we can type class(evtdata) to know evtdata is a ToggleEventData class,Matlab must know, callbackFunction must know it too!
Just like everyone knows cows are mammals

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Platform and License 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by