Why App Designer wants to always save changes even if nothing is changed?

2 次查看(过去 30 天)
This is not a serious problem but it is quite annoying:
Every time when I open mlapp file in App Designer it immediately shows the file has changed and wants to save it after closing, although I have not even clicked anything on the editor. And, especially if I have had a longer session with several files open, I cannot remember which ones I have actually changed and then have to save all to be sure.
This causes extra trouble when using version control, because the saved mlapp is always different, even if there is no changes. So, I end up updating mlapp files to version control all the time even there is no need to. I know that if I would convert mlapp to m-file then version control could detect if there is actually any change, but after conversion to m-file it cannot be edited in App Designer anymore, so it is not a practical option.
Does anybody know why this is happening and is there any fix for it?
I wonder if Mathworks staff is aware of this and going to do anything for it.
  9 个评论
Ameer Hamza
Ameer Hamza 2020-11-3
Ok, I didn't notice it earlier. I tried the two apps you shared. The first time I open it, I get the same behavior (i.e., an asterisk appears to save the file). However, once I save the file and close it, then on the subsequent opening of the files, it does not show an asterisk. I got the same behavior on both windows 10 and macOS.
Also, the first time the asterisk appears is not without reason. It appears after showing the message "app name updated to match the file name". This message appears if you initially created your app with one name and then rename the mlapp file. For example, initially, I named my app as myApp.mlapp; the first line in code view is
classdef myApp < matlab.apps.AppBase
but If I rename the file to myApp2.mlapp and then open the file, the MATLAB will automatically change the first line to
classdef myApp2 < matlab.apps.AppBase
and consequently the asterik appears.
Petri M
Petri M 2020-11-3
Ameer Hamza, yes of course app2 has different classdef name because I was simply copying it with different name just for comparison purposes. That was not the problem.
The problem is that if I open app1 and save it, close App Designer, and open app1 again (for example using command line "edit app1", then App Designer shows it has been changed.
For some reason, there is a difference between this small demo app and my big project app:
With app1 the problem occurs only when I close App Designer and open it again. However, with my big project app the problem occurs also without closing App Designer. But anyway, with both apps the problem occurs if I close App Designer and open it again. And do not ask me to post that big project app, it is confidential.

请先登录,再进行评论。

采纳的回答

Petri M
Petri M 2020-11-11
I am answering myself, because I found out what is causing the bug.
Yes, it is a bug in Matlab. It is happening when using tab size other than default 4 (in preferences). When I create an app using the default tab size of 4, there is no problem. But when I use other than 4 (tried 2 and 6), and create for example just an empty app (create a blank app and save it), then it wants to save it every time after opening the App Desiger (however, you have to close the App Designer in between).
  2 个评论
Mario Malic
Mario Malic 2020-11-11
Nice find!
However, TMW won't notice the bug if it's not submitted to bug reports or if staff sees this question.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by