-
Notifications
You must be signed in to change notification settings - Fork 242
Problem about Drag & Drop #6
Comments
I haven't specifically implemented Drag & Drop in ScintillaNET v3 yet and based on your experience, it doesn't look like we're getting it for free from Windows Forms. Let me investigate and get back to you. |
So I'm looking into this a bit and I don't seem to have any problems dragging items from a TreeView to ScintillaNET. Is the issue that you can't drag items from the TreeView to ScintillaNET? Or is the issue that some of the events are not firing? |
Thank you for your answers. My issue is that DragEnter event and DragDrop event does not fire. I know the Drag & Drop event is inherited from Windows.Forms and I don't understand why it's not working. // TreeView ItemDrag // ScintillaNET events private void scintilla1_DragDrop(object sender, DragEventArgs e) { |
I just do some additional tests. I just noticed that the problem is not the Drag & Drop. So the origin of my issue is elsewhere... Something has to interfere with the correct operation of ScintillaNET. Any ideas ? I'll get ... and I hope to find. Thank you for your time. I appreciate. |
Try: private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
{
treeView1.DoDragDrop(((TreeNode)e.Item).Text, DragDropEffects.Copy);
} I have a pretty good idea why the Drag events aren't firing as you expect, but this should get you what you want for now. BTW - Scintilla events are different from standard Windows Forms control events. Version 3 of ScintillaNET tries to recognize and accept that fact. It isn't a standard Windows Forms control so we shouldn't treat it as such. That being said, I'll see what I can do. :) |
I remember fixing this exact issue in ScintillaNET v2.x so I knew where to look. The issue is that the native Scintilla control automatically registers itself as a drag and drop target before the Windows Forms framework does. The result is that the native Scintilla control handles the drag and drop events instead of raising the Windows Forms DragEnter, DragDrop, etc... events. The fix I decided to go with was to revoke drag and drop support after the native Scintilla control is created but before the Windows Forms framework does registration so that Windows Forms still thinks it is the first one to the party when it registers the control. Unfortunately this means the built-in support that the native Scintilla control already has is no longer being used. It puts a larger burden on ScintillaNET developers to handle the drag and drop events, but it allows more flexibility and so I think it's the right thing to do. |
Okay I understand your explanation. I tried your code and changed my event as you have indicated above me. Now my Drag & Drop works well. Thank you for the solution and for your time. :) |
P.S. Commit 02336ec adds support for This should help you identify the proper document and caret position in your drag and drop operations. |
These methods save my life, thank you ! :) |
…tion Update types in the SCNotification struct
Hello,
I use ScintillaNet and I would like to implement a drag & drop between TreeView and Scintilla.
I developed ItemDrag event for TreeView and DragEnter and DragDrop events for ScintillaNet.
I have verified that the "allowdrop" property is true.
But my problem is that the DragDrop event does not fire.
I do not know what to try...
Thank you for your help.
ps : sorry for my English
The text was updated successfully, but these errors were encountered: