Multiwindow app skips startup function
8 views (last 30 days)
Show older comments
I am working on developing a GUI I inherited from someone else, and am running into a problem. When the GUI pulls up the second window, there are steps in the startupfcn that need to be run, most importantly, mapping the app to app.CallingApp. However, when run from the original GUI it never runs the startup function.
I tried going into debugging, and it goes all the way to graphicsCallbackProxy.m Line 22 in sync with the multiwindow app example on mathworks website. But at that point, the example then runs the startup fxn and my code skips it.
I then created a very simple multiwindow app. the first has a button that opens the second. When I run this GUI, the startup App is correctly run. When I call the popup window in my main code, the startup fcn is once again left unrun.
Code from the main script (Does not trigger the startup fxn below)
function STARTRECORDINGButtonValueChanged(app, event)
value = app.STARTRECORDINGButton.Value;
if value == 1
app.log.markNum = 0;
app.TagApp=testGUI(app);
if app.err % app.err=13, insufficient disc space for file creation
stopStreamRec(app);
end
elseif value == 0
exitLoopStopAcq(app);
end
end
Code from the test popup window
function startupFcn(app, mainApp)
app.CallBack=mainApp;
disp("test 123")
disp(num2str( app.CallBack.x))
end
testing main function, triggers the running of the startup fxn above.
% Value changed function: Button
function ButtonValueChanged(app, event)
value = app.Button.Value;
app.x=1:100;
app.y=sin(app.x);
app.TagApp=testGUI(app);
end
It's worth noting, there is no error tied to the startup fxn not running, only downstream from function calls to the original app, that don't work because the CallingApp was never defined because the startup fxn didn't run. I'm not sure if this matters, but the GUI trying to call a popup is the second window opened, the first window asks for save information, all of which is succesfully passed into the Main GUI.
Has anyone encountered this before, or see what may be causing the issue?
6 Comments
Adam Danz
on 7 Dec 2020
Edited: Adam Danz
on 7 Dec 2020
> my GUI enters the try loop and then immediately exits it without doing anything
Does that mean an error within the try-block within AppManagementService > tryCallback (line 359) evokes the catch-block? If so, when you place a breakpoint right at the first line within the catch-block, what does the exception say? If the try-block is fully executed without evoking the catch-block, does that mean that one of the callback() functions within the conditional statement is executed but has no perceivavble result? If that's the case, what function handles is stored in callback and what are the inputs (app and event)?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!