We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Problem with drag''n drop

Thread ID:

Created:

Updated:

Platform:

Replies:

24673 Feb 9,2005 04:19 AM Feb 14,2005 11:06 AM Windows Forms 5
loading
Tags: GridControl
Holger Persch
Asked On February 9, 2005 04:19 AM

Hi, I experienced a problem with the grid and drag''n drop. I have written a test app to explain it. When the app is started there are two MDI child windows opened. If I now try to drag a grid cell from the upper window to the lower window then it only works if the DoDragMethod is called with DragDropEffects.All or DragDropEffects.Move. If the DoDragMethod is called with DragDropEffects.Copy the drag icon doesn''t change and the DragDrop event will never been called. I''am missing something here? Thanks in advance, Holger Persch DragDropTest_6313.zip

Administrator [Syncfusion]
Replied On February 9, 2005 09:39 AM

The problem is that the grids internal DragOver event handler is called after your event handler. To workaround this issue you could manually override the virtual event method in the grid: // In InitializeComponent this.gridControl1 = new MyGridControl(); // class public class MyGridControl : GridControl { protected override void OnDragEnter(DragEventArgs e) { base.OnDragEnter (e); e.Effect = DragDropEffects.Copy; //e.Effect = DragDropEffects.Copy; System.Diagnostics.Debug.WriteLine(string.Format("gridControl1_DragOver: AllowedEffect = {0}, Effect = {1}", e.AllowedEffect, e.Effect)); } protected override void OnDragOver(DragEventArgs e) { base.OnDragOver(e); e.Effect = DragDropEffects.Copy; //e.Effect = DragDropEffects.Copy; System.Diagnostics.Debug.WriteLine(string.Format("gridControl1_DragOver: AllowedEffect = {0}, Effect = {1}", e.AllowedEffect, e.Effect)); } } Then it should work. Stefan >Hi, > >I experienced a problem with the grid and drag''n drop. I have written a test app to explain it. When the app is started there are two MDI child windows opened. If I now try to drag a grid cell from the upper window to the lower window then it only works if the DoDragMethod is called with DragDropEffects.All or DragDropEffects.Move. If the DoDragMethod is called with DragDropEffects.Copy the drag icon doesn''t change and the DragDrop event will never been called. > >I''am missing something here? > >Thanks in advance, >Holger Persch > >DragDropTest_6313.zip > >

Holger Persch
Replied On February 14, 2005 03:03 AM

Hi Stefan, Thanks, it works now. But why does the GridOleDropTarget component responses to drag''n drop notifications although it isn''t activated in the grid''s ControllerOptions property? Regards, Holger

Administrator [Syncfusion]
Replied On February 14, 2005 04:55 AM

The events are being subscribed to in the grid''s contructor which is too early for the property settings to prevent handling these events. To avoid this, you can derive the grid and set a property in your default contructor. public class MyGridControl : GridControl { public MyGridControl():base() { this.Model.Options.DataObjectConsumerOptions = GridDataObjectConsumerOptions.None; } }

Holger Persch
Replied On February 14, 2005 06:28 AM

OK, I understand now. I was a little bit confused because I used the same functionality in some other places without the need to derive a new grid class. Thanks, Holger

Administrator [Syncfusion]
Replied On February 14, 2005 11:06 AM

Holger, actually - that the grid did respond to OleDragDrop events is a bug. I fixed that now. When you disable ControllerOptions.OleDropTarget then no Ole drop target code from the grid will get hit at all. You will not see the outline cell anymore then when you drag over the grid. Additionaly I also ensured that the grids OleDropTarget handler (when it is enabled ...) will be handled before any event is raised to the outside. Stefan >OK, I understand now. > >I was a little bit confused because I used the same functionality in some other places without the need to derive a new grid class. > >Thanks, >Holger

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;