From: Alexander on
Hi,

I'd like to accelerate appearance of my GUI on screen. Now it takes about 3 sec on my
computer (desktop) and about 5-6 sec on another (notebook). My GUI consists of 3 dozens
panels with controls and I turn on only those which I need (in OpeningFcn).

During the first appearance I can see that panels are shown at incorrect
positions and then in a second they are moved to final place (sort of short cartoon).

I tried to identify the moment when this happens and found that it happens
at one line of code: set(gui_hFigure, 'Visible', 'on') in Matlab function (gui_mainfcn).

Is it possible to speed up? When I call Guide for my GUI I don't see such slow effect.

Thank you for any hint.
Alexander
From: Walter Roberson on
Alexander wrote:

> I'd like to accelerate appearance of my GUI on screen. Now it takes
> about 3 sec on my
> computer (desktop) and about 5-6 sec on another (notebook). My GUI
> consists of 3 dozens
> panels with controls and I turn on only those which I need (in OpeningFcn).
>
> During the first appearance I can see that panels are shown at incorrect
> positions and then in a second they are moved to final place (sort of
> short cartoon).
>
> I tried to identify the moment when this happens and found that it happens
> at one line of code: set(gui_hFigure, 'Visible', 'on') in Matlab
> function (gui_mainfcn).
>
> Is it possible to speed up? When I call Guide for my GUI I don't see
> such slow effect.

Could you clarify what you mean by "first appearance" and "second appearance"
? Generally speaking if you are creating a GUI it is a good practice and the
most efficient to make the figure Visible off until you have finished putting
all of the pieces in to it, and then make it Visible on .

3 dozen panels sounds like quite a bit; that is surely going to take a while
to position everything properly and render all of the controls. Perhaps it
would make more sense to put some of the panels in another figure? Or perhaps
it would be more efficient for drawing to put the panels in to invisible
figures and then when the panel is needed, to set the panel 'Parent' to the
main figure and set the old panel 'Parent' to an invisible figure?
From: Alexander on
> Could you clarify what you mean by "first appearance" and "second appearance"

Appearing of my program on screen lasts several ("long") seconds. During this process
I have time to choose a moment to press PrintScreen. So I restarted program several
times and "tracked" phases of main GUI figure appearing on the screen. "First appearance" - is
a first phase - only headers of panels in incorrect places, next - the same + gray background,
the last - panels shifted on correct positions.

> most efficient to make the figure Visible off until you have finished putting
> all of the pieces in to it, and then make it Visible on .

I do so. I have several big overlapped panels. Only one is turned on.

> 3 dozen panels sounds like quite a bit; that is surely going to take a while
> to position everything properly and render all of the controls.

Why then I don't notice this effect when starting GUIDE for my GUI?

> ... perhaps
> it would be more efficient for drawing to put the panels in to invisible
> figures and then when the panel is needed, to set the panel 'Parent' to the
> main figure and set the old panel 'Parent' to an invisible figure?

What is the difference in drawing invisible panel on another invisible figure or
doing the same thing on my main figure? By the way, looking at screenshots
(got by PrintScreen) I see header for a (sub)panel inside the turned off panel which
is not visible at final stage. According to your idea - it must not be so, as I understand.

I'd prefer to have a way to fully prepare a figure and then instantly show it.
Tried making Visible = off for the main figure and turning it on in OpeningFcn but with no effect.

Thanks,
Alexander
From: Walter Roberson on
Alexander wrote:

> Why then I don't notice this effect when starting GUIDE for my GUI?

A GUI created by GUIDE opens a figure which has the rendered GUI in it.
From: Alexander on
Walter,

thank you for the answer.
So as I understand there is no way to speed up rendering GUI with many controls.

I work with some models - every model is placed on its big panel. And number of
models is growing. Now my .fig file for GUI is about 70Kb and its .m - file about 270 Kb.
Is it considered a lot?

I am ready to create controls dynamically for any model but I don't see any functions
to delete controls.

Could you advise something to improve the situation?

Alexander