How to clear all EditFields in App Designer that were dynamically generated
Show older comments
Hi everyone, thanks for taking the time to read my question. I am still a novice, so please forgive me.
I am making a GUI that reads in data from a yaml file, presents it to the user in edit fields, and the user will be able to modify the values.. So when the user selects a type in the dropdown menu, the callback function dynamically generates Edit Field Labels and Edit Fields using the yaml data.
I used this very helpful answer to generate the EditFields/Labels:
I was able to sucessfully import the data how I needed to. The only problem is that the yaml struct fields are not all the same across different types, so if the user selects a type in the dropdown menu again, the callback function just generates labels on top of the space that was already used.
I either need a way to reset the GUI to exactly how it is when the GUI is launched (I tried a 'Clear All' button as seen below, but it does not work)
or I might need a way to check if the Labels are the same, and if they are not, clear the Label instead of writing on top of it.
Any help would be greatly appreciated! Thank you!
function ClearProfileButtonPushed(app, event)
startupFcn(app)
drawnow;
figure(app.UIFigure)
end
1 Comment
Geoff Hayes
on 27 Jun 2022
@Akana Juliet - we would probably need to see the code that you have written that creates the edit fields, but I suspect that since you are dynamically creating them (if I read this correctly), then you can just delete them when needed.
Accepted Answer
More Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!