Thread Subject: Another strange GUI question

Subject: Another strange GUI question

From: wapo

Date: 1 Oct, 2008 06:39:17

Message: 1 of 5

Hi all,

This is another question on my series of questions regarding GUIS. I
hope mathworks is reading.

Situation: A GUI coupled with a heavy script. The script is running in
the background and the GUI is waiting for the script to finish. If we
overlap the MATLAB GUI with another window (lets say the browser) and
then return back to the GUI then the GUI is messed up. Segments of it
are not visible any more or there is white background color, etc.

Why is that? I am guessing that MATLAB is doing the rendering of the
window and since its stuck with the script it cannot update the GUI
(although it shouldn't have been messed-up in the first place).

Any help anybody? Mathworks?

Thanks in advance

Apo

Subject: Another strange GUI question

From: Bruno Luong

Date: 1 Oct, 2008 07:01:04

Message: 2 of 5

wapo <apostolos.georgakis@gmail.com> wrote in message <fdc52253-f776-46ab-bd52-959e36553be9@34g2000hsh.googlegroups.com>...
> Hi all,
>
> This is another question on my series of questions regarding GUIS. I
> hope mathworks is reading.
>
> Situation: A GUI coupled with a heavy script. The script is running in
> the background and the GUI is waiting for the script to finish. If we
> overlap the MATLAB GUI with another window (lets say the browser) and
> then return back to the GUI then the GUI is messed up. Segments of it
> are not visible any more or there is white background color, etc.
>
> Why is that? I am guessing that MATLAB is doing the rendering of the
> window and since its stuck with the script it cannot update the GUI
> (although it shouldn't have been messed-up in the first place).
>
> Any help anybody? Mathworks?
>

You should insert statements in the script to call now and then REFRESH or DRAWNOW so as matlab flushes the queue graphic events. Otherwise, yes, the script could take the high priority of CPU and figure is not updated as often as you like.

I don't know what alternative you have if the CPU is stuck in a single long built-in function. Probably running a parallel timer that call periodically drawnow.

The graphic display is usually no "messed-up" (even if you think so) just delayed.

And let me guess your OS: probably Windows?

Bruno

Subject: Another strange GUI question

From: wapo

Date: 1 Oct, 2008 07:22:10

Message: 3 of 5

Hi Bruno,

Thanks for your answer but I still dont get it for the following
reason. The script is not supposed to update the GUI. The GUI is just
sitting there waiting. So, in theory the GUI doesnt need re-rendering.
It's MATLAB that gets messed-up.

Yes, the OS is windows. Does that mean that it's the OS's
responsibility the mess? Because I dont see similar issues with other
programs. So, I am guessing (once again) that MATLAB keeps the control
of the figure and when stuck with something heavy does have the time
to refresh the different buffers in the graphic card (and in that case
your answer makes sense; so in theory if it's MATLAB fault the
refreshing should work).

I will this anyway and see what happens.

Apo

Subject: Another strange GUI question

From: Bruno Luong

Date: 1 Oct, 2008 07:54:01

Message: 4 of 5

wapo <apostolos.georgakis@gmail.com> wrote in message <6c6fb094-85c4-4240-b254-c041b22bf4f7@k30g2000hse.googlegroups.com>...
> Hi Bruno,
>
> Thanks for your answer but I still dont get it for the following
> reason. The script is not supposed to update the GUI. The GUI is just
> sitting there waiting. So, in theory the GUI doesnt need re-rendering.
> It's MATLAB that gets messed-up.

No. Graphic objects are created as small rectangle "standalized" across softwares and handled by OS (all graphic objects of Windows are rectangular shape, that why the OS is called WINDOWS). OS are responsible to issues "Events", and software (MATLAB) are (could be) responsible for refreshing the button when an event is received from OS. Software does not when their buttons are hidden by a Browser. And when the Browser moves out "someone" must refresh the button. Who is "someone"? It could be OS or Matlab, depending on the Event Callback is captured or not.

In principle, how and how often the Events are proceeded is managed by a default scheme that works all right for most of the cases. However your script, even if it does not work directly with GUI, can disturb the timings of the graphical refreshing, and you should be aware about it, and take an appropriate action when you are putting your code together with GUI. This phenomenon is problematic for Windows based software, which is historically is a mono-thread OS.

Bruno

Subject: Another strange GUI question

From: Jan Simon

Date: 6 Oct, 2008 13:32:01

Message: 5 of 5

Dear wapo!

Did you enable the BackingStore property of the figure?
If the renderer is OpenGL, problems with missing updates can depend on the graphic card's driver also.

Jan

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

rssFeed for this Thread

Contact us at files@mathworks.com