Why do the function must pass event.EventData object

조회 수: 3 (최근 30일)
fa wu
fa wu 2023년 8월 3일
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