I have designed an app where the user specifies some input for execution of some functions. I have a button for "run", for which I have created a callback for button pushed. Some of the code is given below. What the code does is first to disable the button so that one cannot accidentally press "run" twice. Then it just checks a website for a license and gives a warning dialog/changes a light color. After that my functions begin, and that part is not problematic so I have omitted it.
What happens is, when I press the "run" button in the app in a non-debug mode, the button is kept enabled, even though the first line in the callback is to disable the button. If I run the exact same code, but put breakpoints and click continue manually, it executes the code properly.
If I'm not connected to the license server (the try catch statement and the following if statement are both executed), the code runs properly and gives me a warning dialog. I can also see that it disables the button, shows the dialog then enables it again (intended).
Now this has happened before in the normal script editor, with some plots. But there I was not sure if there was some code I was not aware of, that may have caused the problem. Here I am pretty sure that there is not anything working other than the code below. Any suggestions?
function runButtonPushed(app, event)
if app.vpn.Color(2)~=1 && contains(app.abqServer.Value,'1')
warndlg('Ingen anslutning till KTH:s VPN','Varning')
if ~isempty(app.g_Bilder); delete(app.g_Bilder); end