Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MainFrame SetRedraw to false before Child Closing

MainFrame SetRedraw to false before Child Closing

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiodebugginghelptutorial
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    baerten
    wrote on last edited by
    #1

    Hello everybody, in my MDI application, I use a theApp.MainFrame->SetRedraw(FALSE); to freeze the mainframe during the child window creation, to avoid creation flickering. When I close the child, I use the same technique. If the user hits the ESC key, I make the theApp.MainFrame->SetRedraw(FALSE); then I close the child. This technique works great for the creation of the child, but at the destruction it makes a big error. The mainframe seems transparent for all kind of inputs. The mainframe is correctly redrawn but mouse and key inputs are directly send to the window "under" my application (Visual Studio when i debug, for example) and this other window gets the focus. Has anyone an idea? Big thanks

    E 1 Reply Last reply
    0
    • B baerten

      Hello everybody, in my MDI application, I use a theApp.MainFrame->SetRedraw(FALSE); to freeze the mainframe during the child window creation, to avoid creation flickering. When I close the child, I use the same technique. If the user hits the ESC key, I make the theApp.MainFrame->SetRedraw(FALSE); then I close the child. This technique works great for the creation of the child, but at the destruction it makes a big error. The mainframe seems transparent for all kind of inputs. The mainframe is correctly redrawn but mouse and key inputs are directly send to the window "under" my application (Visual Studio when i debug, for example) and this other window gets the focus. Has anyone an idea? Big thanks

      E Offline
      E Offline
      Eugen Podsypalnikov
      wrote on last edited by
      #2

      Does the effect (lost focus) exist when you do not set anything at the child closing ? :)

      virtual void BeHappy() = 0;

      B 1 Reply Last reply
      0
      • E Eugen Podsypalnikov

        Does the effect (lost focus) exist when you do not set anything at the child closing ? :)

        virtual void BeHappy() = 0;

        B Offline
        B Offline
        baerten
        wrote on last edited by
        #3

        No, then all is working correctly That's strange to me :(

        E 1 Reply Last reply
        0
        • B baerten

          No, then all is working correctly That's strange to me :(

          E Offline
          E Offline
          Eugen Podsypalnikov
          wrote on last edited by
          #4

          Could you try it ? :) :

          // ESC scope
          {
          CWnd* pcWnd = AfxGetMainWnd();
          pcWnd->LockWindowUpdate();
          // Close a child here
          ...
          pcWnd->UnlockWindowUpdate();
          }

          virtual void BeHappy() = 0;

          B 1 Reply Last reply
          0
          • E Eugen Podsypalnikov

            Could you try it ? :) :

            // ESC scope
            {
            CWnd* pcWnd = AfxGetMainWnd();
            pcWnd->LockWindowUpdate();
            // Close a child here
            ...
            pcWnd->UnlockWindowUpdate();
            }

            virtual void BeHappy() = 0;

            B Offline
            B Offline
            baerten
            wrote on last edited by
            #5

            I removed the LockWindowUpdate / SetRedraw(FALSE) (both won't work correctly) out of the closing-traitement. The first childwnd is created nicely, but if I open a second one, than the SetRedraw doesn't affect. I see the new frame a half-second on another position as the correct end-position. That seems ugly :sigh: Before I used a GetDesktopWindow()->SetRedraw(FALSE) ... that worked great, but it's very risky. If an error occurs, the Desktop-Window is never been redrawn correctly :~ How would you fix this kind of workarround. Simply create a child window, which will be displayed only after all sub-controls are created and the their positions are well moved. Big thanks :)

            E 1 Reply Last reply
            0
            • B baerten

              I removed the LockWindowUpdate / SetRedraw(FALSE) (both won't work correctly) out of the closing-traitement. The first childwnd is created nicely, but if I open a second one, than the SetRedraw doesn't affect. I see the new frame a half-second on another position as the correct end-position. That seems ugly :sigh: Before I used a GetDesktopWindow()->SetRedraw(FALSE) ... that worked great, but it's very risky. If an error occurs, the Desktop-Window is never been redrawn correctly :~ How would you fix this kind of workarround. Simply create a child window, which will be displayed only after all sub-controls are created and the their positions are well moved. Big thanks :)

              E Offline
              E Offline
              Eugen Podsypalnikov
              wrote on last edited by
              #6

              Maybe, you could create the childs invisible (~WS_VISIBLE) and then call ShowWindow(..) for them ? :)

              virtual void BeHappy() = 0;

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups