PasteDragDrop event

SyntaxEditor for WPF Forum

Posted 8 years ago by James Deadman
Version: 11.2.0551
Avatar
Hi,

I am trying to use the SyntaxEditor PasteDragDrop event to detect when files are dropped onto the view (we will then open these dropped files in other views).

Although we receive the event for the DragEnter ("PasteDragDropAction.DragEnter") action, we never seem to receive any further events such as for drop ("PasteDragDropAction.DragDrop").

Would you have some idea if i've overlooked something please?

I have pasted the code below which im using to test it:
public void PasteDragDropEvent(System.Object sender, ActiproSoftware.Windows.Controls.SyntaxEditor.PasteDragDropEventArgs e)
{
    // A drop operation was performed over the Editor
    
    if (e.Action == PasteDragDropAction.DragEnter)
    {
        e.Text = "";    // set to non-null to allow dropping
        e.DragEventArgs.Effects = System.Windows.DragDropEffects.Copy;
    }
    
    if (e.Action == PasteDragDropAction.DragDrop)
    {
        // drop occured, check for files
        // <---   NEVER REACHES HERE
    }
}

Comments (4)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi James,

Thanks for the sample code. It appears that a switch statement we have for e.Effects to end up raising the PasteDragDrop event for drops wasn't working in this scenario because e.Effects contained Link. We've updated it for the next build to support your example.

Unfortunately setting the Effects as you do doesn't update the e.Effects we receive for the drop event so there isn't a workaround until the next build.


Actipro Software Support

Posted 8 years ago by James Deadman
Avatar
Hi,

Thanks for your quick reply.

Sorry can i confirm about your reply. You mentioned that PasteDragDrop isnt working in this scenario, is there a different way we can get it to work? We're not so worried about setting particular e.Effects, we just want to detect the file drop action. Is it possible to achieve this in a different way please?

I wasnt sure what you meant by "e.Effects contained Link".

Thanks,
James
Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I looked but unfortunately I don't believe there is any way you can work around this until the fix is out since there is a lot of internal code that is handling drag/drop events and would block anything you could try.

The drop event receives an e.Effects property with a flags indicating allowed effects. If "Link" is one of those effects (which it is for files) it wasn't hitting our switch's case statement that would allow the drop to continue and raise the PasteDragDrop event.


Actipro Software Support

Posted 8 years ago by James Deadman
Avatar
Okay, thanks for checking.

We'll have to wait on the next release.
The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.