Sign in to follow this  

Parent window is not updating

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone, I have a quick question. Please keep in mind that I am using OpenGL, C++, and the Win32 API. When a window (for example, a child dialog) gets in front of the main window, and we move it around, it seems the parent window never updates until after we have stopped moving the child window. This is where the problem is at...
Notice that, if we move the child window around, the parent window starts getting painted with its background color. Only until after I stop moving it (the child window, whatever window it may be) does the parent window update everything. Does anyone know what may be causing this? Does anyone know a way to resolve the problem? Thanks :)

Share this post


Link to post
Share on other sites
A small update...

It seems in some of the dialogs (The dialogs that require to be closed before returning back to the primary window). When these types of dialogs are moved, the primary parent window simply does not update until the dialog is closed.

Trying to handle a WM_PAINT message in the parent window seems to only make things worse.

This is becoming a problem as it makes everything much harder to see. I am willing to post some code if only I knew what to post.

All help is appreciated.

Share this post


Link to post
Share on other sites
Quote:

Handling WM_PAINT is the correct way to fix this. What do you mean it "makes things worse"? What are you doing in your WM_PAINT handler?

Im glad some one finally responded to this :) Thanks!

Now I have some direction to look at. At the moment I am not handling WM_PAINT. When I first ran into this problem, I was thinking of having WM_PAINT re-render the current scene. However, the scene is already being updated at 60 fps, so it creates terrible flicker.

Is their something in particular that I should do in WM_PAINT?

Thanks again in advance for any replies.

Share this post


Link to post
Share on other sites
A possible solution is to perform all rendering on WM_PAINT and only there.
Where you used to do the render (in the main loop), force your window to be redrawn.

Forcing a window to be redrawn is something like this I think (not tested):

InvalidateRect(window, NULL, TRUE);
UpdateWindow(window);


Share this post


Link to post
Share on other sites
Why does it cause flicker? I don't really see how it should change anything?

In my engine (C++ / DirectX) I do the exact same thing; render normally in my main loop, and call my Render() function from within WM_PAINT.

Share this post


Link to post
Share on other sites

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this