How to speed up GUI redraw?

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
BBSnowman
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Nov 25, 2004 6:39 pm
Contact:

How to speed up GUI redraw?

Post by BBSnowman » Thu Nov 25, 2004 6:56 pm

Hi everybody...

my issue is the speed the GUI draws some text on the screen.

I wrote a tiny progress dialog with a simple gauge and some text on it. The frame is derived from wxDialog and is brought to screen via Show() in the ctor. Perfect so far. But when I create the dialog the gauge runs fine but the text is not drawn at all. To avoid this, I added a wxSleep(1) at the end of the ctor and that works. But that couldn't be the right way, could it?

Is there a function like wxWaitRedraw() or something like that? Waiting a second for the GUI to draw some text hurts!

Thanks for your hints
Chris

[wxWindows 2.4.2/vc7 2003/WinXP]

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Re: How to speed up GUI redraw?

Post by Ryan Norton » Sun Nov 28, 2004 2:53 am

BBSnowman wrote:Hi everybody...

my issue is the speed the GUI draws some text on the screen.

I wrote a tiny progress dialog with a simple gauge and some text on it. The frame is derived from wxDialog and is brought to screen via Show() in the ctor. Perfect so far. But when I create the dialog the gauge runs fine but the text is not drawn at all. To avoid this, I added a wxSleep(1) at the end of the ctor and that works. But that couldn't be the right way, could it?

Is there a function like wxWaitRedraw() or something like that? Waiting a second for the GUI to draw some text hurts!

Thanks for your hints
Chris

[wxWindows 2.4.2/vc7 2003/WinXP]
Are you overloading the paint event or are you using a wxClientDC to draw on the window?

If doing the former, are you double-buffering it?
[Mostly retired moderator, still check in to clean up some stuff]

BBSnowman
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Nov 25, 2004 6:39 pm
Contact:

Post by BBSnowman » Tue Nov 30, 2004 1:43 am

None of both. I don't handle a paint event. I'm only creating the text in the constructor.

What do you mean by double-buffering?

Jasper
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Sep 21, 2004 1:49 pm
Contact:

Post by Jasper » Sat Dec 04, 2004 3:31 pm

How do you handle drawing the guage vs. the text? If the text doesn't draw at all and a sleep solves the problem it sounds to me like your progress bar update function is blocking the main event loop (although I still wouldn't now why it wouldn't draw at all, but I don't know exactly what you're doing, so it's rather difficult to tell), so you may want to try updating the progress bar on idle events (one step at a time, don't block it!) or something like that (Yield might work too).

Jasper
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Sep 21, 2004 1:49 pm
Contact:

Post by Jasper » Sat Dec 04, 2004 3:32 pm

BTW, double-buffering is a scheme in which you draw on a memory dc and then display that when you've finished drawing, instead of drawing directly to the screen.

Post Reply