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

DragEnter Event not firing on TextBox or TextArea #2155

Closed
jcharlebois-Markeys opened this issue Mar 1, 2022 · 1 comment · Fixed by #2191
Closed

DragEnter Event not firing on TextBox or TextArea #2155

jcharlebois-Markeys opened this issue Mar 1, 2022 · 1 comment · Fixed by #2191
Labels
Milestone

Comments

@jcharlebois-Markeys
Copy link

Trying to use DragEnter/DragDrop on a textbox or TextArea in tis case to drop file names into the Text control is not working.
It appears that teh DragEnter Event is not being fired

Expected Behavior

When draging a File onto a text box useing DragEffects.link fie the DragEnter Event and DragDrop Event to allow the link.localPath to be assigned to textbox.text

Actual Behavior

a thumbnail image appears at the cursor but the DragEnter event never fires

Steps to Reproduce the Problem

  1. Drag File from Explorer onto the TextBox

Code that Demonstrates the Problem

using System;
using Eto.Forms;
using Eto.Drawing;
using System.Linq;
using System.Diagnostics;
using MyControl = Eto.Forms.TextBox;

namespace EtoApp1
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            Title = "My Eto Form";
            MinimumSize = new Size(400, 400);

			var drawable = new MyControl { };
			drawable.AllowDrop = true;
			drawable.DragEnter += Drawable_Drag;
			drawable.DragDrop += Drawable_Drag;
			drawable.BackgroundColor = Colors.White;

			Content = new StackLayout
			{
				Padding = 10,
				Items =
				{
					drawable 
				}
			};
        }
		private void Drawable_Drag(object sender, DragEventArgs e)
		{
			e.Effects = DragEffects.Link;

			var files = e.Data.Uris.Select(r => r.LocalPath).ToArray();
			Debug.WriteLine(files);
			foreach (var file in files)
			((MyControl)sender).Text=file ;
		}
	}
}

Specifications

  • Version: 2.6.1
  • Platform(s):
  • Operating System(s): <Windows 10 Pro, version 21H2 -->
    On XamMac under macOS 12.2.1 the event works fine on a TextBox
@cwensley
Copy link
Member

cwensley commented Mar 3, 2022

Thanks for reporting the issue!

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

Successfully merging a pull request may close this issue.

2 participants