Alternative to waitfor? Need menu functionality using dialog but waitfor freezes everything until the GUI is closed.

7 views (last 30 days)
Using R2012b I've previously created a GUI menu using "menu" but that has limitations (cannot group multiple choices into a dropdown) and also it's not recommended - dialog is recommended instead for multiple choice dialog boxes. See http://www.mathworks.com/help/matlab/ref/menu.html and http://www.mathworks.com/help/matlab/ref/dialog.html for reference.
dialog is working fine for me except for the waitfor. Using menu, I'm able to have my GUI menu, choose a selection that plots something for instance, and go back to my GUI menu where I'm waiting for another user input. But I'm not locked out of clicking on my plot(s) and moving them around, etc. However, recreating this GUI menu using dialog and uicontrols (which does allow me to group items in drop down menus so that's good), I'm forced to using waitfor to stop execution and wait for the user input. The bad thing is, everything else in MATLAB is locked out too - if I try to click on those plots to bring them upfront or move them, it just dings. Menu didn't do this - it allowed me to access those plots while still waiting for a user input.
How can I get this functionality back using dialog/uicontrol? Is this something to do with modal vs. non-modal?

Accepted Answer

TastyPastry
TastyPastry on 9 Oct 2015
Try changing the 'WindowStyle' property to 'normal'. The default for dialog() is 'modal', which means the dialog box created is always on top of the other GUI windows and makes the other windows inaccessible.
  1 Comment
Thrashercharged
Thrashercharged on 9 Oct 2015
That did it! Thanks! It's frustrating that MATLAB recommended that dialog be used instead of menu but doesn't clearly document how to make them behave the same, and all my web searching couldn't turn up this answer.

Sign in to comment.

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!