How to delete the setting uimenu from the app.contextmenu component

10 views (last 30 days)
Hi, I want to set the uimenu objects in app.contextmenu dynamically. just like following code:
function ContextMenuOpening(app, event)
app.ContextMenu = cmHandle;
uimenu(cmHandle,'Label','Wider');
uimenu(cmHandle,'Label','Inspect');
end
end
The problem is that the app.contextMenu will save all added uimenu in every funtion calling and never drop repeated items. I need a answer to clear all children in app.ContextMenu.
Thanks a lot!
Yuhao Sun

Answers (1)

Voss
Voss on 10 Jan 2023 at 23:34
"I need a answer to clear all children in app.ContextMenu."
delete(app.ContextMenu.Children)

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!