Comments (9)
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.
from scintillanet.
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?
from scintillanet.
Thank you for your answers.
My issue is that DragEnter event and DragDrop event does not fire.
With visual studio I debug my application and I see that the ItemDrag event fires but not the other two.
After taking a node in the TreeView and I move my mouse in the control ScintillaNet nothing happens. The mouse cursor tells me I can not. I took a screenshot to be more clear.
I know the Drag & Drop event is inherited from Windows.Forms and I don't understand why it's not working.
my code :
// TreeView ItemDrag
private void treeView1_ItemDrag(object sender, ItemDragEventArgs e) {
treeView1.DoDragDrop(e.Item, DragDropEffects.All);
}
// ScintillaNET events
private void scintilla1_DragEnter(object sender, DragEventArgs e) {
e.Effect = DragDropEffects.Copy;
}
private void scintilla1_DragDrop(object sender, DragEventArgs e) {
if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
{
scintilla1.Text = scintilla1.Text.Insert(1, ((TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode")).Text);
}
}
from scintillanet.
I just do some additional tests. I just noticed that the problem is not the Drag & Drop.
Indeed, I tried to implement the click event and other event and they too do not fire.
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.
from scintillanet.
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. :)
from scintillanet.
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.
from scintillanet.
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. :)
The Scintilla project is impressive. 👍
from scintillanet.
P.S. Commit 02336ec adds support for CharPositionFromPoint[Close]
, PointXFromPosition
, and PointYFromPosition
methods which make it possible to convert mouse coordinates to document positions and vice versa.
This should help you identify the proper document and caret position in your drag and drop operations.
from scintillanet.
These methods save my life, thank you ! :)
from scintillanet.
Related Issues (20)
- Changing EOL type crashes Scintilla HOT 4
- Help!!! How to setting color of default text HOT 2
- Avalonia UI support HOT 1
- Help! Cannot find a mask that works for RgbaImage marker symvol HOT 1
- How do i remove this corner? HOT 1
- How does line indentation work? HOT 1
- Question Regarding Combined Characters and Regex
- Failed to create component 'Scintilla' HOT 4
- sign project
- How can I remove the background color of the focused line? HOT 2
- Is there any way to highlight BETWEEN characters?
- Scrollbar don't work
- Scintilla Control causes caret in other controls to jump/bug HOT 1
- STOP drag drop on windows
- Lexer.Html does not support code folding
- Error on HEREDOC php HOT 3
- Cant drag ScintillaNET control into the form.
- Undo and Redo HOT 1
- .Lines[intIndex].Position always returns 0. - Latest version, not 3.6 release.
- Find in files feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scintillanet.