Callback function not found for dynamically created app UI component
3 次查看(过去 30 天)
显示 更早的评论
I would like to dynamically/programmtically create a uidropdown component that calls a function when its value is changed. However, even though I provide a function handle as the ValueChangedFcn property, the uidropdown is unable to find the function. I receive the error below.
Undefined function 'DropDownChange' for input arguments of type 'matlab.ui.control.DropDown'.
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 305)
Error while evaluating DropDown PrivateValueChangedFcn
I am attaching a simple app created in R2016b that exhibits this behavior. Why can't the function be found? How should I define it to resolve the issue?
2 个评论
采纳的回答
更多回答(2 个)
Bear
2021-11-15
I have a similar issue.
I'm creating a submenu voice with a file path and I want to associate a function. The idea is the add a voice every time the user selects a directory in order to have a history of selected folders.
I would like to catch also the event when the user selects a folder in order to retrieve the selected path and move to that folder.
mitem = uimenu(app.RecentpathsMenu,"Text",user_dir,"MenuSelectedFcn",@(~,~)app.ChangePath);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Develop uifigure-Based Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!