How can I prevent questdlg bonking?

8 visualizaciones (últimos 30 días)
geotocho
geotocho el 6 de Sept. de 2017
Comentada: Jed el 3 de Feb. de 2020
Hi,
Provided is a simple construct not a working example of a code which bonks to excess until questdlg is satified. The relentless bonking overtakes all user control (keyboard and mouse). Is there a piece of code which mutes the neediness of questdlg?
while true
string = questdlg(...)
if strcmp(string, otherString)
do this task
end
update truth
end
tldr: quesdlg bonks relentlessly when unanswered within while loop. What is a simple fix to allow the user to do other tasks on their computer while leaving questdlg unanswered?
  3 comentarios
Steven Lord
Steven Lord el 7 de Sept. de 2017
From context I assume bonk means "modal dialog flashes when you attempt to click on another window." For example, click Open in the Toolstrip to bring up the file selection dialog then try to click back on the MATLAB Desktop. On my Windows machine, the edges of the dialog blink for a little while to try to draw your attention to the window that needs attention.
geotocho
geotocho el 7 de Sept. de 2017
Analyst- Definition 3 most closely resembles my expression of bonk. Thanks Steven for more professionally identifying the dialogue box bonking in your response.

Iniciar sesión para comentar.

Respuestas (4)

Steven Lord
Steven Lord el 7 de Sept. de 2017
As Robert said, questdlg waits for you to answer. If it was able to proceed to the next line if left unanswered, what would you expect the variable string (BTW if you're actually using that as the name of your variable you may want to change it since now string has a meaning in MATLAB) to be on that next line where you compare it to otherString?
  2 comentarios
geotocho
geotocho el 7 de Sept. de 2017
Editada: geotocho el 7 de Sept. de 2017
Can questdlg wait more like an adult and less like needy child? Because the MATLAB task will not proceed without my input, I would like the prompt to wait more wistfully for my response as I peruse the internet or another script in my editor window. The loud neediness of the questdlg bonk has the capability to lock my control from the PC so I must ctrl + alt + F7 to ssh and kill the MATLAB PID. This is quite a nuisance when large data is in memory. Memory demand on my process is also likely the cause for lockout when bonking is induced.
John D'Errico
John D'Errico el 7 de Sept. de 2017
Um, just don't use questdlg? There are far more usable interface styles in existence.

Iniciar sesión para comentar.


Robert U
Robert U el 7 de Sept. de 2017
Hi geotocho,
since questdlg() is using an uiwait-command to prevent the user from interacting with the window the only suggestion is to write your own myQustdlg - GUI using dialog() in which the window is created as you desire.
questdlg() souce code can be read in Matlab R2014b. Thus, you can gain some inspiration.
Kind regards,
Robert
  2 comentarios
geotocho
geotocho el 7 de Sept. de 2017
I suppose this thread is more food for the developers thought. I appreciate your encouragement. But an answer to my question would provide the modification to questdlg to hush the puppy.
Robert U
Robert U el 8 de Sept. de 2017
Hi geotocho,
the function questdlg() is well documented and "open source". In case the functionality of that particular function is not serving your needs the only option would be to program your own. Even for that there are enough possibilities inside Matlab.
The same question was asked in 2011: https://de.mathworks.com/matlabcentral/newsreader/view_thread/314299. It was answered properly by Phil Goddard.
The developers you would like to feed are driven by customer needs. It seems that since 2011 there are not much customers asking for that feature or they are helping themselves.
Kind regards,
Robert

Iniciar sesión para comentar.


Walter Roberson
Walter Roberson el 7 de Sept. de 2017
There is no option to questdialog that has the behavior you are asking for. The behavior of modal dialogues is controlled by your operating system, not by MATLAB.

Jed
Jed el 9 de En. de 2020
Editada: Jed el 9 de En. de 2020
There is a good answer to your question here:
  2 comentarios
Walter Roberson
Walter Roberson el 9 de En. de 2020
No, if you do not use modal then the code will not wait for the reply, and will either destroy the dialog or continue without having received any answer.
Jed
Jed el 3 de Feb. de 2020
Walter: I am a somewhat inexperienced user on this forum, but I have still seen your name enough (and read enough of your answers) to know that you are a guru and someone to be trusted.
I am loathe to disagree with you, but I have tried modifying the questdlg.m function to remove the modal option and (for me at least) the question still blocks the code until a button is selected. I am using linux and an old 2012 version of matlab, so perhaps it is different for others. From the help text of questdlg, I read:
% QUESTDLG uses UIWAIT to suspend execution until the user responds.
and here is the code that implements this functionality from questdlg.m:
if ishghandle(QuestFig)
% Go into uiwait if the figure handle is still valid.
% This is mostly the case during regular use.
uiwait(QuestFig);
end

Iniciar sesión para comentar.

Categorías

Más información sobre Dialog Boxes en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by