Smooth Multi-window workflow in App Designer

1 view (last 30 days)
I am building an application with several windows. My goal is to create a workflow which looks like a common "installation workflow" (e.g. installation of Matlab).
My app works, but I have some graphical issues while opening the new window.
When I hit "Next"-Button on my first GUI (let's call it GUI1), the following code is called:
% Button pushed function: Next
function NextButtonPushed(app, event)
% start GUI2 window
GUI2(app, app.GUI1.Position);
end
This opens GUI2 with the following start-up function:
% Code that executes after component creation
function startupFcn(app, appBefore, position)
% copy subject (struct of data) to new app
app.subject = appBefore.subject;
% get same position as app before + [Menu Bar shift]
app.GUI2.Position = position + [0 22 0 0];
% close app before
delete(appBefore);
end
This works fine while debugging step-by-step. As soon as I run it without debugging, I have a problem with closing my first app (GUI1). In my opinion GUI1 should be closed after GUI2 is loaded, therefore, we should not even see GUI1 closing. For the user it should be more like another page. Unfortunately, while running the apps normally GUI1 is closing even before GUI2 is plotted. I believe this must be a graphical issue (small delay with plotting the new window). A pause() statement before delete(appBefore) actually does what I want. Unfortunately, the delay time is quite random, which makes it unusable. Is there a solution to wait until the app is loaded completely before executing delete(appBefore)?
Another small issue is this menu bar shift. I do not really understand why having a menu bar increases my window size after the first time it is plotted. So far, I could not find a better workaround than adding this shift.
I would appreciate any help. Thanks a lot.
  3 Comments
Nguyen Thuan
Nguyen Thuan on 21 Jul 2020
@ Reto Christen: Hi Reto. I am designed an app that is similar to yours: My wanted workflow is the same as the process of installation a software.
Could you explain what is GUI1 and GUI2 in your code? Are they separate .mlapp files (separate apps) or just functions that you created?
Is it possible for you to upload your source code?
Thanks a lot!
Reto Christen
Reto Christen on 22 Jul 2020
Hi Nguyen
GUI1 and GUI2 are two separate .mlapp files (separate apps) which I can call from each other.
This code was originally written with Matlab 2018b. While putting some test files together I noticed that the [Menu Bar shift] of [0 22 0 0] is not necessary anymore (Matlab 2020a). Looks like MathWorks fixed this issue.
The uploaded source code contains the main-App (aka. GUI1), two additional pop-up apps (about and email) and the next app called geometry (aka. GUI2). Unfortunately, I had to delete quite a lot of content in order to share this source code. But I still believe that it is useful to get the essential point.
Please let me know if something is unclear to you.

Sign in to comment.

Answers (0)

Categories

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

Community Treasure Hunt

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

Start Hunting!