Thread: Window Drag / Blur

  1. #1
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92

    Question Window Drag / Blur

    Hi I have two quick questions,

    Ive attached two screenshots of my problems

    1) When i drag the window - i get this blur occuring (as shown) . How do i stop this from happening? Note im using openGL to do all the drawing. Is this the problem? Im using double buffering etc when drawing so it cant be this?

    2) Another similar problem:

    When i use the menu to click an command say "New"

    The menu stays in a permanent state of being dropped down, even tho i cant click it, how do i get rid of this?


    Thanks in advance!

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    How often does your screen redraw?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92
    For example when i click the New in the menu .. a dialog box pops up and focus is set to that. If i drag it for example it blurs the screen/leaves the menu still open until i close the dialog box.

  4. #4
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92
    is there a way to set focus to the parent window - so i can re-draw the scene each time a DialogBox calls WM_MOVING and then re-set focus back to that DialogBox or am i barking up the wrong tree?

    Edit:-

    Hm doesnt seem to work - im using OpenGL to do all the drawing - i cant seem to find anything to help me !
    Last edited by ventolin; 07-25-2004 at 05:57 PM.

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    26
    Try to put all the drawing in OpenGl in WM_PAINT. That could work.

  6. #6
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Quote Originally Posted by ventolin
    For example when i click the New in the menu .. a dialog box pops up and focus is set to that. If i drag it for example it blurs the screen/leaves the menu still open until i close the dialog box.
    This is because the window client area is not being updated in response to WM_PAINT as ganonl has suggested. Put a call to whatever your opengl 'drawing/rendering' function is in a WM_PAINT handler.

    This will probably lead to a new problem - menu flicker (if you get to see the menu at all). The workaround for this is to handle WM_INITMENU and WM_EXITMENULOOP where you call ValidateRect and InvalidateRect respectively. Validating the client causes your opengl rendering to 'pause' allowing the menu to be drawn and invalidating resumes client area rendering. Something like:
    Code:
    case WM_PAINT:
      OpenGL_Drawing_Fn(); /*or whatever you've called it*/
      return 0;
    case WM_INITMENU:
      ValidateRect(hwnd,0);
      return 0;
    case WM_EXITMENULOOP:
      InvalidateRect(hwnd,0,0);
      return 0;
    This assumes a message loop using PeekMessage and not GetMessage.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  7. #7
    Registered User ventolin's Avatar
    Join Date
    Jan 2004
    Posts
    92
    Ok thanks for the responses, ill try these suggestions out

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C or C++
    By AcerN30 in forum Game Programming
    Replies: 41
    Last Post: 05-30-2008, 06:57 PM
  2. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  3. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  4. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM