App Designer keeps adding multiple Instances of EditFields with the same name on startup
43 views (last 30 days)
Show older comments
Hello Everyone!
I am having a strange problem with the app designer right now:
Every time I start the app designer and load the .mlapp-File of the Project I'm currently working on, there are multiple instances of the same EditField created. It began with only one copy of an EditField I manually added on the GUI. I didn't think much about it and simply deleted the second instance. But it seems like this problem has grown exponentially with every start of app designer. Now, when I open up my Project 500 (!!) EditFields with the same name are created! 'Simply' deleting all of them is obviously not anymore an acceptable workaround - especially since 'ctrl+a' doesn't work in the Component Browser and you have to selected them all manually...
I have no idea why the app designer creates these multiple instances on the startup - after I deleted all multiple instances, they also didn't appear in the non-editable Function 'createComponents(app)' anymore.
Does anyone of you have an idea on that? Where in my code could be a bug causing this phenomenon? Or could this be an appdesigner-internal bug? The project itself is already quite big with ~260 components even without those multiple and unwanted EditFields...
I'm desperately looking for your help! Thanks a lot in advance.
7 Comments
Paul Kelly
on 8 Aug 2023
It isn't just EditFields. I created a custom component (which takes up a lot more resources than EditField) and added it to a Parent app..The Parent application now has over a thousand instances of this component and just hangs up whenever I try to open it.
Henry
on 3 Apr 2024
Same issue here, running the latest version of 2024a
Always when loading I have to rewrite the callbacks because it unlinks the component (which is duplicated) to the callback
Answers (4)
Alex
on 20 May 2023
Edited: Alex
on 20 May 2023
I recently had a similar issue and the more I tried to correct it the more duplicate EditFields appeared, even after deleting everything from my app they would still reappear.
The only way I could correct the problem was to go to the canvas tab and convert it to a different type (in my case I was using app without reflow, so I selected a reflow option), then I set it back to my original choice and it solved my issue. I deleted the duplicates after converting, but I would assume that it was the conversion that resolved it and not the order of deleting.
Hopefully that will help if the other comment does not.
0 Comments
Benoit Beaulieu
on 17 Mar 2024
Edited: Benoit Beaulieu
on 17 Mar 2024
I had the same issue but I found a way to fix it once and for all.
Here's the issue: Instances of the problematic objects are kept in the components.UIFigure.Children object references and therefore are recreated at every load.
Here's what you have to do:
- Once your mlapp is loaded, delete all instances of the unwanted object. This step is optionnal, but will prevent the need of deleting them from the xml file late on.
- Save and close the mlapp file.
- Rename the mlapp file with ".zip" extension.
- Open the archive and navigate to "Filename.mlapp.zip"\appdesigner
- Load the appModel.mat file into MatLab
- Delete every instances of the unwanted object you can find within "components.UIFigure.Children" using the delete function
delete(components.UIFigure.Children(1:16)) % Delete the 16 first objects referenced in children
- Save all loaded variables as a mat file named appModel.mat
save appModel.mat
- Replace appModel.mat in "Filename.mlapp.zip"\appdesigner (drag and drop)
- Remove the .zip extension renaming the filename
- Reload the .mlap file and Voilà!
if you didn't delete the objects before saving the mlapp, you'll also need to delete the corresponding entries in the xml : "Filename.mlapp.zip"\matlab\document.xml. Each objets is referenced 2 times in the documents. the structure looks like the "code view" of the app designer.
3 Comments
Benoit Beaulieu
on 3 Apr 2024
I did the procedure using the embedded windows zip manager. I know unzipping the file and rezipping it would corrupt the mlapp, hence the drag n drop procedure of the appModel.mat file. In my case, all other files remained untouched.
Have you tried copying the entire content of the .mlapp.zip and put it back with the modified appModel.mat?
Alex Ander
on 4 Apr 2024
Thank you so much, now it worked. Used 7-Zip and drag and drop and all other files remained untouched.
Yemi Ajayi
on 30 Sep 2020
I'm going to put this here in case this does help anyone else who has run into this issue as I did yesterday.
The only thing I discovered that worked was to delete ALL current instances of EditField in my component browser (luckily there were only 4 duplicates), AND delete any callbacks, functions, etc that references that EditField from the code browser. Save. Close.
On the next launch, another single copy of the same EditField showed up and I deleted that. Save. Close. This seemed to solve the issue on my next launch as no more copies showed up.
Honestly, I am very wary of using EditFields now due to this. I'm actually very sure that I only dragged one copy of it initially into my app design.
Anyway, I hope this helps someone.
1 Comment
Arnaud Dieudonné
on 20 Feb 2022
This is not working for me .... this bug is terrible. Is someone know how to fix it .. ?
Sherman Marcus
on 17 Apr 2024
Benoit's solution didn't work for me. After removing every single instance of my edit field object from the source and from "components.UIFigure.Children", meaning the name of the object appeared no where in the file, it still returned with a vengeance, producing 13 instances of the object. I then noticed, though, that if I remove all instances of the object, save the file and open it again, I have one fewer instances than before, and it did not return to "components.UIFigure.Children". So I went from 13 to 12 to 11 etc. until the delinquent object was gone, never to appear again. Hope this helps.
1 Comment
Pieter Livens
on 6 Aug 2024 at 9:10
Thanks! That did it for me.
After three times opening, deleting and closing everything was OK.
Then I entered the numeric edit field again, and now everything works again.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!