필터 지우기
필터 지우기

Waitbar always on top and "bong" sound

조회 수: 2 (최근 30일)
MRR
MRR 2012년 11월 19일
답변: Jose Caballero 2016년 7월 1일
Hello,
I have a GUI and I do an iterative (loop) computation. I have used the waitbar command. To hold the waitbar always on top I use the modal setup, i.e.:
h = waitbar(0,'Please wait...','WindowStyle', 'modal');
This is so far the only way I have found to hold the waitbar on top. However, I hear several "bong" noisy sounds while the computation is being carried out.
Here: http://www.mathworks.com/matlabcentral/newsreader/view_thread/288932 I read "The bong will be given each time you move the cursor outside of the modal window. It is a normal part of defining a window to be modal."
Is there any way to have a waitbar on top without such a "bong" sounds?
Best,
-M
  댓글 수: 1
Daniel Shub
Daniel Shub 2012년 11월 20일
Does this have to be OS independent? Is using a timer with a refresh rate of 10 Hz "always" enough?

댓글을 달려면 로그인하십시오.

답변 (3개)

Jan
Jan 2012년 11월 19일
Do I understand correctly: The sound is not triggered by the code itself, but by moving the cursor out of the modal dialog? (Which operating system produces this behaviour?) If so, what about leaving the pointer inside the dialog, because you cannot click to anything outside at all?
As fas as I know under Windows the warning sounds appear only, if you try to click on external objects outside the modal dialog, and this is the wanted behavior to remember the user, why the computer does not react to these clicks.
You can open the waitbar without the modal-flag and use another tool to keep the window on top - searching for these terms in the FEX will be helpful.

MRR
MRR 2012년 11월 20일
Hello Jan,
Thank you for your answer. The sounds are triggered independently if I move or not the cursor, inside or outside the modal dialog. And those sounds are (I think) related with the operations I am carrying out in the following code:
h = waitbar(0,'Please wait...','WindowStyle', 'modal', 'title', 'Simulating');
averagedErrorParam = [];
for i = 1:NumberOfIterations
errorParam = Simulate_Callback(hObject, eventdata, handles);
averagedErrorParam = [averagedErrorParam; errorParam];
waitbar(i/NumberOfIterations, h);
end
close(h);
"Simulate_Callback" performs some plots and cleaning ( such as cla(handles.axes1) ). I think each time im plotting the sounds are being triggered.
Best,
-M
  댓글 수: 1
Jan
Jan 2012년 11월 20일
I do not see any reasons for beeps in the posted code. You can search the code for beep() commands.

댓글을 달려면 로그인하십시오.


Jose Caballero
Jose Caballero 2016년 7월 1일
Hi,
Same behavior here, no beep() calls in my code. I get beeps even if the mouse cursor is always within the modal window.
Jose

카테고리

Help CenterFile Exchange에서 Dialog Boxes에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by