MainFrame SetRedraw to false before Child Closing
-
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
-
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
Does the effect (lost focus) exist when you do not set anything at the child closing ? :)
virtual void BeHappy() = 0;
-
Does the effect (lost focus) exist when you do not set anything at the child closing ? :)
virtual void BeHappy() = 0;
-
Could you try it ? :) :
// ESC scope
{
CWnd* pcWnd = AfxGetMainWnd();
pcWnd->LockWindowUpdate();
// Close a child here
...
pcWnd->UnlockWindowUpdate();
}virtual void BeHappy() = 0;
-
Could you try it ? :) :
// ESC scope
{
CWnd* pcWnd = AfxGetMainWnd();
pcWnd->LockWindowUpdate();
// Close a child here
...
pcWnd->UnlockWindowUpdate();
}virtual void BeHappy() = 0;
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 :)
-
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 :)
Maybe, you could create the childs invisible (
~WS_VISIBLE
) and then callShowWindow(..)
for them ? :)virtual void BeHappy() = 0;