input prompt do not work in callback function
Afficher commentaires plus anciens
i can work around this problem, however because of my OCD i have to ask. the input function do not prompt what it is in a function that is called from UI callback.
function test
f = figure;
f.ButtonDownFcn = @func;
end
function func(~,~,~)
disp('button was down')
b = input('input prompt here :', 's');
disp(['the input was: ' b])
end
the output is:
>> test
button was down
this is my data
the input was: this is my data
>>
is it a bug or i missed something?
6 commentaires
Birdman
le 5 Fév 2018
What are you trying to do here? It is not clear.
There may be a bug or not (haven't checked) but in my opinion forcing the user to switch from a GUI to the command prompt is very poor UI design. Even if it worked properly, as a user I would not even look at the command prompt after clicking on the GUI and thus would be left wondering why nothing was happening having no clue that the command prompt is waiting for my input.
Use inputdlg if you must and even better put the input fields directly in your GUI.
shahar hirshfeld
le 6 Fév 2018
shahar hirshfeld
le 6 Fév 2018
Guillaume
le 6 Fév 2018
Well, yes of course, it depends on the application. I would argue though that if your GUI needs inputs from the user, then these inputs should be part of the GUI in the first place. Even inputdlg is problematic, modal dialogs may be simple but they're not flexible as you say.
When designing UI you have to bear in mind that the user may not work the same way you do. For example, if presented with a docked figure, the first thing I'll do is undock it and move it to a different screen and possibly minimise matlab's main window. Hence I probably wouldn't notice your input prompt.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur App Building dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!