Question about uiwait - Unwanted beep when passing to a second modal GUI

2 views (last 30 days)
I have two GUIs. Pressing a button on my first GUI leads to a second GUI that is modal, pauses the first GUI with uiwait, and requires that the user answer a yes or no question in the second GUI before the window closes and resumes the first GUI with uiresume. So the code for the button callback in the first GUI looks something like this:
SecondGUI
uiwait(gcf)
% more code
And the code for the callback of either of the two buttons in the second GUI could look something like this:
% code
uiresume(gcbf)
close
Because the second GUI is modal, once it is activated, performing uiwait in the first GUI produces an unwanted beep. Is there a way around this, or do I just have this conceptually all wrong?

Accepted Answer

Walter Roberson
Walter Roberson on 11 Oct 2012
Modal dialogs effectively do their own uiwait()
  2 Comments
Andrew
Andrew on 11 Oct 2012
Then I must be doing something else wrong, because when I take the uiwait and uiresume out of both GUIs entirely and press the button, the first GUI calls the second, and then finishes the rest of the code in the button's callback without waiting for the second GUI to close.
Andrew
Andrew on 24 Oct 2012
I eventually found that the first GUI was waiting for the second GUI's opening function to complete before it finished its own code. Seems obvious to me now. I eventually solved the problem by completing my code in the callback for 'Yes' in the second GUI. So like you said, modal boxes effectively do their own uiwait, all i need to do was use it.

Sign in to comment.

More Answers (0)

Categories

Find more on Maintain or Transition figure-Based Apps 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!