Announcement

Collapse
No announcement yet.

Performance, flicker and redraw issues

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Performance, flicker and redraw issues

    Hello again- long time no see

    So, I really need help in this case. I've got a parentwindow, and 2 childs with a PB-GRAPHIC CONTROL on it- the controls are as big as their window. The GRAPHIC CONTROLS are subclassed, to recieve all kind of WM-Messages to manage their positions per drag-and-drop.

    To get more performance while changing coordinates/size of my GRAPHIC-windows (theres a possibility to mark more than one window at a time), I send to my parent
    SendMessage(hParent, %WM_SetRedraw, 0, BYVAL %NULL) every time the mouse has moved while pressing the left button of the mouse.

    After this SET_REDRAW message I do all the reposition stuff, and, of course I send
    SendMessage(hParent, %WM_SetRedraw, 1, BYVAL %NULL) to my parent. Cause this isn't working without any redraw commands, I added "DIALOG REDRAW hParent". But in this case this can be very counterproductive- If I just move 1 graphic window, all other childwindows of my parent are flickering while sizing/moving.

    Is there a possibility to get all windows which need redraws, without redraw the entire parentwindow with all childwindows to avoid this flicker?

    Best regards,
    Marc Giesmann
    Last edited by Marc Giesmann; 21 Oct 2008, 10:47 AM.

  • #2
    Hi! After a "few" (it really took 2 days) trys, experiments and researches on my problem, I found BeginDeferWindowPos-DeferWindowPos-EndDeferWindowPos, and I really think, it works "like a charm"

    That was some more implementation-changing, than I thought.

    But that really takes me to another question:
    Sometimes I have to draw very much stuff per

    Code:
    BeginPaint(hWorkspace, ps)
       hMemDC = CreateCompatibleDC(ps.hDC)
       hOldBmp = SelectObject(hMemDC, CreateCompatibleBitmap(ps.hDC, rcClient.nRight, rcClient.nBottom))
    If my drawing features on my parent are activated, they need a little to get drawed correctly. After my new implementation with the DeferWindowPos commands, I thought- "hey, if my moving windows are showing up correctly after the DeferWindowPos-Procedure- why don't include my parent?" This would be helpful, cause in the case of PARENT-redraw, theres still a little flicker. My idea is, to force an update per DeferWindowPos- so that all windows are drawn at the same time. But, whyever, my little DeferWindowPos, made for my parentwindow, is stopping all my other DeferWindowPos precessings- without any error. Heres some pseudocode- which is similar to mine- I commented everything, to give you a better idea of whats going on.

    Code:
    LOCAL hWndPos AS DWORD
    'How many windows do I have? ARRAY_LENGTH measures: 1 Object per ARRAY lenght + 1 parent to update!
    hWndPos = BeginDeferWindowPos( ARRAY_LENGTH(ACTIVE_OBJECTS) +1)
                         
    IF hWndPos THEN
       FOR i=LBOUND(ACTIVE_OBJECTS) TO UBOUND(ACTIVE_OBJECTS)
          'The hWndPos parameter is committed BYREF to change the original value
          OBJECT_MOVE(ACTIVE_OBJECTS(i), hWndPos)
       NEXT
                            
       'And heres the strange one- this command stops the whole
       'DeferWindowPos commands from the "move window". If I comment this part,
       'everything works like a charm...
       hWndPos = DeferWindowPos (BYVAL hWndPos, BYVAL hPARENT, BYVAL %NULL, _
                                                BYVAL 0, BYVAL 0, BYVAL 0, BYVAL 0, _
                                                BYVAL %SWP_NOSIZE OR %SWP_NOZORDER OR _
                                                %SWP_NOMOVE OR %SWP_NOACTIVATE)
       'Isn't showing up
       IF GetLastError() 
          MSGBOX "ERR#" + STR$(GetLastError())
       END 
         
       EndDeferWindowPos(hWndPos)
    END IF
    Thanks in advance and best regards,
    Marc Giesmann
    Last edited by Marc Giesmann; 23 Oct 2008, 03:28 AM.

    Comment


    • #3
      But, whyever, my little DeferWindowPos, made for my parentwindow, is stopping all my other
      DeferWindowPos precessings- without any error.
      The windows in a BeginDeferWindowPos/DeferWindowPos/EndDeferWindowPos call should all be at the
      same level in the window hierarchy. That is, they must all be siblings. That is why DeferWindowPos
      fails when the parent is added to the mix .
      Dominic Mitchell
      Phoenix Visual Designer
      http://www.phnxthunder.com

      Comment


      • #4
        Dominic,
        thanks for your reply. So this way is definitly wrong =/
        Any suggestions? This really freaks me out...

        Comment


        • #5
          Maybe too simple but do you have %WS_CLIPCHILDREN in the style of your dialogs?
          This will prevent redrawing of areas covered by child controls reducing flickering a lot.
          thinBasic programming language
          Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

          Comment


          • #6
            WOW, I just added it to my childs. Clipsiblings was alreeady included, and clipchildren was already included in my parentwindow.

            Whatever this does- it works a little (in some situation way more than a little) better.

            Thanks.

            DEFERWINDOWPOS + CLIPCHILDREN really gives performance boosts and it looks way nicer! Thank you very much!

            Best regards,
            Marc Giesmann

            Comment


            • #7
              Originally posted by Marc Giesmann View Post
              Whatever this does ...
              When you repaint a dialog it starts from repainting the full background of the window (usually gray or whatever color you have decided). This visually destroy the controls over it. Than all controls are repainted. If you fire too much repaint, flickering is very visible.

              %WS_CLIPCHILDREN instruct the dialog that when it receive a redraw message it will not redraw the areas covered by child controls. This will prevent control to disappear/reappear from screen.

              Ciao
              Eros
              thinBasic programming language
              Win10 64bit - 8GB Ram - i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

              Comment

              Working...
              X