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

Dragging LayoutAnchoreable into outer docking buttons of floating document result in Exception #117

Closed
Dirkster99 opened this issue Feb 2, 2020 · 6 comments
Labels

Comments

@Dirkster99
Copy link
Owner

Dirkster99 commented Feb 2, 2020

The solution to this problem should be to not offer the 4 outer drop buttons when dragging an item on over a Floating Document Control (as implemented for dragging a LayoutAnchoreable over another floating LayoutAnchoreable).

Test with MLibTest:

  • review bin (sub)folder and remove the AvalonDock.Layout.config file if present

  • compile and start MLibTest application

  • Load a Text file into the demo application:
    Untitled

  • Drag the text file into floating state
    Untitled1

  • drag & drop a LayoutAnchorable (tool window) over one of the outer (red marked) drop buttons
    Untitled2

Issue: The System throws a NotImplementedException:
Untitled3

Stacktrace:

System.NotImplementedException
  HResult=0x80004001
  Message=The method or operation is not implemented.
  Source=AvalonDock
  StackTrace:
   at AvalonDock.Controls.DocumentPaneDropAsAnchorableTarget.Drop(LayoutAnchorableFloatingWindow floatingWindow) in ...\Avalondock\source\Components\AvalonDock\Controls\DocumentPaneDropAsAnchorableTarget.cs:line 82
   at AvalonDock.Controls.DropTarget`1.Drop(LayoutFloatingWindow floatingWindow) in ...\Avalondock\source\Components\AvalonDock\Controls\DropTarget.cs:line 98
   at AvalonDock.Controls.OverlayWindow.AvalonDock.Controls.IOverlayWindow.DragDrop(IDropTarget target) in ...\Avalondock\source\Components\AvalonDock\Controls\OverlayWindow.cs:line 744
   at AvalonDock.Controls.DragService.Drop(Point dropLocation, Boolean& dropHandled) in ...\Avalondock\source\Components\AvalonDock\Controls\DragService.cs:line 145
   at AvalonDock.Controls.LayoutFloatingWindowControl.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in ...\Avalondock\source\Components\AvalonDock\Controls\LayoutFloatingWindowControl.cs:line 362
   at AvalonDock.Controls.LayoutAnchorableFloatingWindowControl.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) in ...\Avalondock\source\Components\AvalonDock\Controls\LayoutAnchorableFloatingWindowControl.cs:line 245
   at System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
@Dirkster99 Dirkster99 added the bug label Feb 2, 2020
@Dirkster99
Copy link
Owner Author

This page shows different drop target configurations - I think we need the PART_DocumentPaneDropTargets configuration for the test case shown above - I just don't know the exact code part to configure this, yet :-(

@Dirkster99
Copy link
Owner Author

This screenshot shows that VS supports dragging tool windows into a floating document window:
VS_FloatingDocument_withToolWindows

The Quick fix in this zip file shows how the outer 4 buttons can be deactivated from being displayed - I would not like this solution because the background cross of the drop buttons is still visible to support 9 buttons - I think this solution is just a short term hack:
AvalonDock_QuickFixCandidate_117.zip

@Dirkster99
Copy link
Owner Author

I have added one more commit into Branch 117. This commit should leave the outer 4 buttons functional and position the FloatingLayoutAnchoreableWindow as expected (from a users point of view).

The code added was based on the DocumentPaneDropTargetDrop(LayoutDocumentFloatingWindow floatingWindow) method.

Its the low risk quick and hacky solution I am suggesting to get this release out the door.

@mkonijnenburg
@scdmitryvodich What do you guys think about this hack?

I am now also seeing the problem that dragging the FloatingDocumentWindow (with LayoutAnchorable inside) back into the MainContainer makes the LayoutAnchorable dissappear :-( There, must be a filter (somewhere) where this type of content is skipped in this case(?).

@amolf-se
Copy link
Contributor

The disappearance might be due to the IsSinglePane property, It only looks at documents, not anchorables. Hopefully it can be matched somewhere that closes the window. Changing the property messes up the definition, so that might cause other undesired side effects.

@scdmitryvodich
Copy link
Contributor

As far as I see attempt to use outer buttons adds some issues which will require some time to be properly handled.
As a quick decision I would suggest to follow the idea of hiding outer buttons. I've created PR #130 which implements such hiding (basing on proposed changes in AvalonDock_QuickFixCandidate_117.zip) and fixes some problems with it.

Dirkster99 added a commit that referenced this issue Feb 26, 2020
…tons

Fix #117 with hiding outer docking buttons.
@Dirkster99
Copy link
Owner Author

The disappearance might be due to the IsSinglePane property, It only looks at documents, not anchorables. Hopefully it can be matched somewhere that closes the window. Changing the property messes up the definition, so that might cause other undesired side effects.

I am not sure about the IsSinglePane property but it does not seem to be the problem when I drop the FloatingDocumentWindow (containing a LayoutAnchorable) back into the DocumentPane. I discovered in Issue #132 that the outer buttons of the DocumentPane already accept this situation (see Test Case 1), while the inner button silently swallows everything not being a LayoutDocument (see Test Case 2).

So, the Drop implementation for the DocumentPane appears to be inconsistent in this regard, which I am intendending to fix with the change in the branch Issue_132.

@mkonijnenburg
@scdmitryvodich
Can you see any obvious problem with this fix?

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

No branches or pull requests

3 participants