Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
waitbar/processbar with windows, always on top

Subject: waitbar/processbar with windows, always on top

From: pedro moreno

Date: 10 Aug, 2010 13:03:05

Message: 1 of 8

Hello matlab's partners!
Well, the problem it's not easy, at least for me... I have a GUI with a lot of calculations, and i want to put a waitbar or a progressbar (getting from http://blinkdagger.com/matlab/matlab-gui-tutorial-progress-status-bar/), I dont care if one option or the other. This is the appearance for waitbar (similar for progressbar):

h = waitbar(0,'Por favor espere...'); %point 1
     ...calcutation1
waitbar(0.1,h);
     ...calculation2
waitbar(0.2,h);
      ....several calculations and waitbar
waitbar(1,h);close(h);

Well, the problem is that waitbar is created, but only appears in point 1, the rest of time it's hidden in the taskbar. Anybody knows the way that waitbar is always on top? (waitbar windows in front of GUI)(user must be always reported on the processing...)
Thanks in advance!
Greetings

Subject: waitbar/processbar with windows, always on top

From: machatsk

Date: 10 Aug, 2010 14:33:10

Message: 2 of 8

"pedro moreno" <pjmf17@hotmail.com> wrote in message <i3rim8$32b$1@fred.mathworks.com>...
> Hello matlab's partners!
> Well, the problem it's not easy, at least for me... I have a GUI with a lot of calculations, and i want to put a waitbar or a progressbar (getting from http://blinkdagger.com/matlab/matlab-gui-tutorial-progress-status-bar/), I dont care if one option or the other. This is the appearance for waitbar (similar for progressbar):
>
> h = waitbar(0,'Por favor espere...'); %point 1
> ...calcutation1
> waitbar(0.1,h);
> ...calculation2
> waitbar(0.2,h);
> ....several calculations and waitbar
> waitbar(1,h);close(h);
>
> Well, the problem is that waitbar is created, but only appears in point 1, the rest of time it's hidden in the taskbar. Anybody knows the way that waitbar is always on top? (waitbar windows in front of GUI)(user must be always reported on the processing...)
> Thanks in advance!
> Greetings


If you have a for loop in your calculations, you can update the waitbar as the for loop executes. For instance:
      for a=1:number
         x=waitbar(a/number, 'Message') % a will change, so waitbar will update
         close(x)
     end
You'll need to close the waitbar within the loop so you don't get one thousand waitbars on your taskbar.
             Maxx

Subject: waitbar/processbar with windows, always on top

From: Jan Simon

Date: 10 Aug, 2010 14:59:05

Message: 3 of 8

Dear Pedro,

> Well, the problem is that waitbar is created, but only appears in point 1, the rest of time it's hidden in the taskbar.

Do you mean, the window is hidden behind other windows? Or did you apply a magic trick to minimize the window? Otherwise I have no idea, how the Window could move into the taskbar.

Kind regards, Jan

Subject: waitbar/processbar with windows, always on top

From: pedro moreno

Date: 12 Aug, 2010 11:00:22

Message: 4 of 8

Well, waitbar with for loop I just knew, but it's not easy, because calculation1, 2, ... this calculations aren't for loop, else secuencial operations (not loops). In this sence, like waitbar is a fake, because only show 5 states in my case (0%, 20%, 40%, 80% 100%), but with this, i want one target "user, dont click nothing, because matlab is processing". The only thing for this was perfect is that waitbar window is always visible for user, but it always hide in the second updated, 20% (the waitbar window is minimized in taskbar).
Well, if someone know the solution of this, please, I ask for it.... And I think that I can be a great help in the future for people they are beginning in this world.

Thanks in advance
Pedro Moreno

Subject: waitbar/processbar with windows, always on top

From: pedro moreno

Date: 12 Aug, 2010 12:07:06

Message: 5 of 8

Maybe there is a solution:

set(h,'WindowStyle','modal')

But the problem is that this instruction generates several 'bong' error noises, and in the command window no errors are showed. Is very strange, I have no idea... ┬┐anybody has the solution of the mistery?
thx

Subject: waitbar/processbar with windows, always on top

From: pedro moreno

Date: 12 Aug, 2010 12:08:06

Message: 6 of 8

Maybe there is a solution:

set(h,'WindowStyle','modal')

But the problem is that this instruction generates several 'bong' error noises, and in the command window no errors are showed. Is very strange, I have no idea... ┬┐anybody has the solution of the mistery?
thx

Subject: waitbar/processbar with windows, always on top

From: Jan Simon

Date: 12 Aug, 2010 12:29:08

Message: 7 of 8

Dear Pedro,

> The only thing for this was perfect is that waitbar window is always visible for user, but it always hide in the second updated, 20% (the waitbar window is minimized in taskbar).

Again: This is really strange! There is no Matlab method to minimize a window to the taskbar. Therefore you obviously apply a Java or OS call to minimize the WAITBAR window. Keep the window visible is trivial then: Omit this call.
And it would be helpful for the community if you show us, how you minimize the window.

If I miss the point: why/how is the window minimized to the taskbar?

Kind regards, Jan

Subject: waitbar/processbar with windows, always on top

From: Walter Roberson

Date: 12 Aug, 2010 20:33:46

Message: 8 of 8

pedro moreno wrote:
> Maybe there is a solution:
>
> set(h,'WindowStyle','modal')
>
> But the problem is that this instruction generates several 'bong' error
> noises, and in the command window no errors are showed. Is very strange,
> I have no idea... ┬┐anybody has the solution of the mistery?

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.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us