Add new window to OpeningFcn of MATLAB gui goes to back of main window when running

I have a 'Main_window' in MATLAB guide. I want open a 'New_window' when I run 'Main_window', So I add this code in 'OpeningFcn' of 'Main_window' :
New_window();
When I run 'Main_window', 'New_window' goes to back of 'Main_window'. I want it in front of 'Main_window' after running.
What should I do?
Thanks.

 Accepted Answer

Jack - to be clear, you want to launch a second GUI from the first without any user interaction such that the second GUI appears in front of the first? If so, try adding the line of code New_window() to the OutputFcn of the Main_window.

5 Comments

That's true. When I run Main_window, without any user interaction I want run New_window in front of Main_window. I think when I put New_window() in OutputFcn it will appear when I close Main_window. Is this wrong?
Yes your statement is incorrect. If you add the line of code to the OutputFcn in Main_window, then New_window will appear in front of Main_window when you run the latter.
It might be a naive comment but what if you use
uiwait(New_window)
and wait for the user to interact?
Not naive at all. Where would the uiresume go?
Maybe in the CloseRequest function of the New_window? I don't know the exact word for it actually sorry. The idea being that the program resumes to Main_Window only when New_Window is closed.

Sign in to comment.

More Answers (0)

Categories

Products

Asked:

on 31 Jul 2014

Commented:

on 31 Jul 2014

Community Treasure Hunt

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

Start Hunting!