web() and inputdlg() in App Designer

I tried to call the functions web() and inputdlg() from an App Designer app. The functions are stored in another function which is called in the app.
In App Designer
WebAndDlg
the function (as a separate .m file):
function WebAndDlg
% ... some other code that functions well
web(url)
inputdlg(str1, str2)
% ...
end
There is no dialogue box nor the browser opens while the rest of the code works :( Any ideas?

9 commentaires

Mario Malic
Mario Malic le 26 Fév 2021
Hi Robin,
you can test these functionalities by creating an app that contains only these web or/and inputdlg functionalities without calling the function.
I think the inputdlg should work, but I wouldn't know about web. After that you can maybe expand your question with more details if the web doesn't work.
Simon Allosserie
Simon Allosserie le 26 Fév 2021
I have the same issue. It seems that these dialogue boxes that open perfectly when called directly in Matlab or in AppDesigner, fail to open when called in a function through AppDesiger. I'll follow here to see if anyone knows how to fix it; I have asked similar questions on this forum but never got to a solution.
Mario Malic
Mario Malic le 26 Fév 2021
Hi @Simon Allosserie, see Name-Value parameters for inputdlg. I think this is the reason why it doesn't work. Modal WindowStyle expects a figure window to be present with the 'modal' option, yet it probably doesn't see the window made with AppDesigner. If you change this to 'normal', it should probably work.
WindowStyle
'modal' (default) or 'normal'. If set to 'modal', then users cannot interact with other windows before responding.
J. Alex Lee
J. Alex Lee le 26 Fév 2021
inputdlg seems to be based on classic figures rather than uifigures, so I would not expect it to work in a webapp.
i would expect that if they were to ever make available the ability to make input dialogs available, the function name will be preceded with "ui", and the first argument would need to be the base figure (see uialert, e.g.).
i've never used web(), but it says open a browser - i don't think webapps are going to have authority to open a browser on client's computer!
Simon Allosserie
Simon Allosserie le 26 Fév 2021
@Mario Malic thanks for your idea but it still didn't work. I call uigetfile; it works fine in App Designer but not when I compile the app.
Mario Malic
Mario Malic le 26 Fév 2021
There is not a mention of this being a web app. I am totally wrong about WindowStyle property. This property is used if you want to open a figure and disable interactions between other figures until it's closed.
There's an option for web to open the website in MATLAB browser, or the default internet browser.
Robin Schäfer
Robin Schäfer le 26 Fév 2021
Thank you for your comments!!! Those functions work fine when I call them directly in the app (R2020b).
.... I just recognized that an if-statement was wrong. Both functions work when I call the app via the APP Designer environment. I haven't yet tried that in the compiled package (it is going to be a stand-alone desktop app).
@Simon Allosserie which version do you use?
Simon Allosserie
Simon Allosserie le 26 Fév 2021
R2019b
Robin Schäfer
Robin Schäfer le 28 Fév 2021
I have compiled the app and both functions (web and inpudlg) work fine! So, it's actually possible, but I don't know in your case if it has something to do with the versions (e.g. Matlab Runtime) ...

Connectez-vous pour commenter.

Réponses (1)

J. Alex Lee
J. Alex Lee le 26 Fév 2021

0 votes

i think you can get around both limitations with some extra coding...never tried it, and just a thought, but...
you could probably "fake" a modal input dialog with a uipanel containing an uieditfield, that you can position manually within the app figure. The trick is to either disable all interactions in the base figure (if that's important to you) when the uipanel is made visible, or make the uipanel cover the entire app.
for an alternative to web(), maybe as simple as uihtml()...you can set the htmlsource, but i have no idea if that source can be arbitrary locations on the internet.

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by