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. Image for the cookie policy date
close icon

Problem with drag''n drop

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

5 Replies

AD Administrator Syncfusion Team February 9, 2005 02:39 PM UTC

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 > >


HP Holger Persch February 14, 2005 08:03 AM UTC

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


AD Administrator Syncfusion Team February 14, 2005 09:55 AM UTC

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; } }


HP Holger Persch February 14, 2005 11:28 AM UTC

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


AD Administrator Syncfusion Team February 14, 2005 04:06 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon