Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating Window Group does not hide correctly #28

Closed
Dirkster99 opened this issue May 7, 2019 · 2 comments
Closed

Floating Window Group does not hide correctly #28

Dirkster99 opened this issue May 7, 2019 · 2 comments

Comments

@Dirkster99
Copy link
Owner

Dirkster99 commented May 7, 2019

Issue

A Floating Window (Group with at least 2 tool windows) does not hide correctly.

The framework hides only the toolwindows but leaves floating window empty.
There is a NullReference Exception + Crash when user tries to drag the flowting tool window.

Steps to verify (using the MLib_Test client)

  1. Drag 2 tool windows (LayoutAnchorable) into one floating window
    Crash CloseFloatingWindowGroup CloseButton Drag

  2. Close MLib_Test Application to Save the Layout

  3. Restart MLib_Test Application to Reload the Layout

  4. Click Hide (button) of the floating window
    Crash CloseFloatingWindowGroup CloseButton Drag_1

Bug

  • The empty floating window is still visible
  • Dragging the empty floating window leads to a crash
    AvalonDock.Layout.txt

Crash is reproducable with this layout but somehow not with above steps anymore(?):

Dirkster99 added a commit that referenced this issue May 7, 2019
#28
Plus additional tool windows 1-3 for testing with tool windows
@Dirkster99
Copy link
Owner Author

A possible solution is documented in FloatingWindowGroup branch.

This commit changes the:

  1. LayoutAnchorableFloatingWindowControl.OnExecuteHideWindowCommand() by adding a Hide() call to hide the FloatingToolWindows

  2. To bring the hidden element back would require a re-start of the application unless the second addition is implemented in LayoutAnchorable.UpdateParentVisibility():

      // Element is Hidden since it has no parent but a previous parent
      if (this.PreviousContainer != null && Parent == null)
      {
        // Go back to using previous parent
        Parent = PreviousContainer;
        PreviousContainer = null;
      }

This code makes the Tool Window re-appear in the MainWindow when the user tries to unhide it after hidding the FloatingWIndow.

@Dirkster99
Copy link
Owner Author

Dirkster99 commented May 7, 2019

I've tested a little bit with floating windows and found a workflow that was not working OK as a result of the first fix candidate:

  1. Clean_All.bat

  2. Load project in VS and rebuild

  3. Start MLib_Test

  4. Drag all Tool Windows by the title bar into floating state

  5. Close the floating window with Hide (x) button

  6. Exit application (layout is saved)

  7. Re-start application (layout is loaded)
    Bug:
    The hidden Toolwindows cannot be re-shown with Tools>tool window toggle

The cause of this new issue seems to be the PreviousContainer = null; statement in LayoutAnchorable.UpdateParentVisibility() so I removed it with this commit and can no longer reproduce the new issue while the fix continues to work :-)

So, just for clarities sake - the current idea on the fix is this change:

  1. LayoutAnchorableFloatingWindowControl.OnExecuteHideWindowCommand() by adding a Hide() call to hide the FloatingToolWindows

  2. To bring the hidden element back would require a re-start of the application unless the second addition is implemented in LayoutAnchorable.UpdateParentVisibility():

      // Element is Hidden since it has no parent but a previous parent
      if (this.PreviousContainer != null && Parent == null)
      {
        // Go back to using previous parent
        Parent = PreviousContainer;
      }

This code makes the Tool Window re-appear in the MainWindow when the user tries to unhide it after hidding the FloatingWIndow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant