Multiwindow app: runStartupFcn does not execute startupFcn on called app

8 views (last 30 days)
I am writing an app with App Designer, that has a button to call an external app and perform some operations. I followed the instructions provided at Create Multiwindow Apps in App Designer.
I create the external app and tested its correct functioning by using another simple test app I created, containing a single button. I verified that all inputs and outputs are passed correctly between these two apps and that the startupFcn of the external app is correctly executed.
Now I tried to include the call to this external app in a more complex app and I got an unexpected issue: the external app opens, but its startupFcn is not getting executed. I traced the problem to the uneditable part of the external app, executed during the construction of the app:
% Execute the startup function
runStartupFcn(app, @(app)startupFcn(app, varargin{:}))
When I call the external app from the test app this command correctly executes the startupFcn, but when I call it from the more complex app, runStartupFcn does not execute it and does not throw any warning or error message.
I could not find any documentation on runStartupFcn. How this function decides if it executes the startupFcn?
  4 Comments
Walter Roberson
Walter Roberson on 31 Jul 2022
Edited: Walter Roberson on 31 Jul 2022
runStartupFcn turns on handle visibility for the app, runs the provided function handle, and turns handle visibility off again.
The execution layer is within toolbox/matlab/appdesigner/appdesigner/runtime/+appdesigner/+internal/+service/AppManagementService.m near line 122, and the direct invocation is to toolbox/matlab/appdesigner/appdesigner/runtime/+matlab/+apps/AppBase.m near line 68
There is no documentation for it because it is internal functionality not intended to be invoked directly by the user.
Pierdavide Coïsson
Pierdavide Coïsson on 1 Aug 2022
Thank you Walter. With your answers I could realize that AppManagementService.m and AppBase.m had been updated since the release R2020b I was using. I updated MATLAB to R2022a and this problem does not appear anymore. Both calls to this app from the other two apps make its startupFcn to be executed.

Sign in to comment.

Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!