Why is "MODAL" not...

8 vues (au cours des 30 derniers jours)
dpb
dpb le 26 Mai 2021
Modifié(e) : Jan le 26 Mai 2021
% Make sure user doesn't have file locked/open in another process first...
% Excel creates hidden file with "~$" prefix while open; search for this file
chkOpen=true;
while chkOpen
[~,fn]=system(['dir /a:h /b ' fullfile(app.awardPath,['~$' app.awardFile])]);
chkOpen=matches(strtrim(fn(3:end)),app.awardFile,'IgnoreCase',true);
if chkOpen
h=errordlg([app.awardFile "Locked for Edit. Must Close Award File First."],'modal');
waitfor(h)
end
end
...
updateBillingSheet=false;
[tBill,tPay]=readBilling(app.billQualFile,app.billSheet,updateBillingSheet);
...
Why without the waitfor(h) does the above code not wait for the user dialog but executes the call to readBilling immediately despite the 'modal' moniker on the error dialog?
The above fixes the problem, I'd just like to understand why "modal" isn't...

Réponses (1)

Jan
Jan le 26 Mai 2021
Modifié(e) : Jan le 26 Mai 2021
"MATLAB program execution continues even when a modal Error dialog box is active. To block program execution until the user closes the dialog box, use the uiwait function."
This does not explain, why the dialog does not wait, but it clarifies that this is not a bug, but intented.

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by