Multiwindow app skips startup function

조회 수: 8 (최근 30일)
Nicholas
Nicholas 2020년 12월 7일
댓글: Nicholas 2020년 12월 9일
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
Adam Danz
Adam Danz 2020년 12월 7일
편집: Adam Danz 2020년 12월 7일
> 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)?
Nicholas
Nicholas 2020년 12월 9일
No, that was the weird part, it stepped into the try block, then stepped out without doing anything. If it had stepped into something I could have tried figuring out what was going wrong, but I couldn't explain how it was exiting the try block without doing anything.
I just spent the past day and a half rebuilding the GUI that everything is called out of and it resolved the issue. I'm not sure what the underlying cause was but a complete rebuild of the App that wasn't initiating the calls to startupfcns properly was a solution, albeit tediuous one.
Thanks for all your assistance! Have a wonderful day!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by