Matlab - app designer - component name and callback
22 次查看(过去 30 天)
显示 更早的评论
Hi,
In App Designer
How can we know the name of a modified component when his callback is also connected to other component ?
Thks
2 个评论
Adam Danz
2019-8-21
Are you asking how to idenitify which component invoked a callback function in the case where multiple components are assigned the same callback function?
回答(1 个)
Adam Danz
2019-8-21
编辑:Adam Danz
2019-8-22
The 2nd input to a callback function in App Designer is "event'. event.Source is the handle to the object that invoked the callback function. event.EventName is the name of the event (a string).
objHandle = event.Source;
objName = event.EventName;
4 个评论
Adam Danz
2019-8-22
Objects don't really have names. However, you can assign most (all?) objects a name by assigning a string to their Tag property. Then you can identify the object by its tag like this
objHandle = event.Source;
objHandle.Tag
If you haven't assigned a Tag, the tag property will be empty.
René Lampert
2022-1-27
Hy Guillaume,
could you please explain in detail what you mean with " it's useful if the same callback is used to catch different types of events. " I dont get the point out of this phrase. Do you have a minimal example fot this?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!