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.

Destination Rows in Drag and Drop

Thread ID:

Created:

Updated:

Platform:

Replies:

35988 Oct 18,2005 04:53 AM Oct 27,2005 03:28 AM Windows Forms 17
loading
Tags: GridControl
manohar
Asked On October 18, 2005 04:53 AM

Hi There, I am using GridDataBoundGrid.Now when you Drag and Drop the rows small rectangle is appearing as a tail to the cursor.How to show the Top and Bottom rows of Destination in that rectangle,similar to Excel.Please have a look at excel drag and drop to understand my requirement clearly. Thanks in advance, Thanks & Regards, Manohar B.

Administrator [Syncfusion]
Replied On October 18, 2005 05:28 AM

The only row type drag and drop we support in a GridDataBoundGrid is OLE D&D where you first select a range of cells (could be rows), and then move to the cursor to teh border of the range to see the OLE D&D cursor. Then you can mousedown and drag at that point. If you use this type of D&D, then a target rectangle is drawn for you by the grid. (You do have to set grid.AllowDrop = true in order to allow an OLE D&D onto the grid.) Since you are not seeing this behavior, I assume you are not using OLE D&D. This means you likely added special code to your grid to try to support some other type of D&D. In this case, you would also have to add code to draw whatever feedback you want to see during your drag. Without knowing what you are doing, I am not sure what you might do to get this feedback you want.

manohar
Replied On October 18, 2005 06:20 AM

Hi Clay, Now I am getting the rectangle below to the pointer.I am using facility provided by the grid only,from my side only change is I just refresh the row numbers while dragging.Now what i want is,Is there any way to customise that rectangle which you are showing below to the pointer to show the destination Top and Bottom rows like what excel does. Thanks & Regards, Manohar B.

Administrator [Syncfusion]
Replied On October 18, 2005 07:07 AM

Here is a sample. It will let you use OLE D&D to move contents in the grid. If you select a row and move the mouse to the border, you can then mousedown and drag the selection. It shows the destination rectangle as you drag. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_e9259605.zip By default, a GridDataBoundGrid does not support moving rows. If you are supporting moving rows, then what have you done to support it? Can you make the above sample show the behavior you currently see?

manohar
Replied On October 18, 2005 09:28 AM

Hi Clay, What you told is absolutely right.I wrote my own code to move the rows.But my requirement is nothing to do with what should happen while moving.My requirement is with respect to the graphic icon(i.e rectangle) present below the pointer.In ControllerOptions if I switch off OLEDropTarget,I will not be getting the Horizantal line that you are showing currently,in the similar lines I just want to show a rectangle(with data,I have data in my hand, do not worry about that) below to the pointer.Now can you just guide me how to achieve this. Thanks in advance, Thanks & Regards, Manohar B.

Administrator [Syncfusion]
Replied On October 18, 2005 12:02 PM

If you are using the grid to get the little drop cursor somehow, then it is a mouse controller that is handling this cursor. Exactly which mouse controller is being used depends on what you are doing to initiate the drag. Normally to draw visual ques, you use MouseMove. Here is a little sample that does something like this. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_d1855a6.zip If you have our source code, you can take the code in our OLE D&D mouse controller that draws the rectangle, and use that code to create your own mouse controller.

Administrator [Syncfusion]
Replied On October 19, 2005 05:34 AM

Hi Clay, Thanks a lot.My problem is almost solved.Just one more thing left out in the whole requirement,now I need to switch off the small rectangle which is comming below to the pointer. Can you just tell me how to do that.If I switch off any of the following options OLEDropTarget,OLEDataSource,ExcelLikeSelection in the ControllerOptions of the Grid,total drag and drop functionality is getting srewed.So tell me one safe solution which will disappear that small rectangle below to the pointer. Thanks in advance, Thanks & Regards, Manohar B.

Administrator [Syncfusion]
Replied On October 19, 2005 06:13 AM

You haven''t explained how you are initiating the drag. If you are doing it by setting AllowDragSelectedCols = true, then that is why you see the D&D cursor. Setting that property to false will take the cursor away. But then you would have to initiate the D&D in some other way. One way to do this is to save teh mousedown point in the MouseDown event. Then in the MouseMouse event, if the mouse is pressed and you have moved enough away from the mousedown point, you can start your drag. There is a sample of doing something like this at the bottom of this thread. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=15683

Administrator [Syncfusion]
Replied On October 19, 2005 07:23 AM

Hi Clay, What you expected is absolutely right,I am just writing AllowDragSelectedRows = true to enable D&D,the link given below is a bit confusing to achieve the requirement.Can you just give me any other link or anything which support me to fulfill this requirement. Thanks & Regards, Manohar B. >You haven''t explained how you are initiating the drag. If you are doing it by setting AllowDragSelectedCols = true, then that is why you see the D&D cursor. Setting that property to false will take the cursor away. But then you would have to initiate the D&D in some other way. One way to do this is to save teh mousedown point in the MouseDown event. Then in the MouseMouse event, if the mouse is pressed and you have moved enough away from the mousedown point, you can start your drag. There is a sample of doing something like this at the bottom of this thread. >http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=15683

Administrator [Syncfusion]
Replied On October 19, 2005 11:15 AM

Here is anothe rway you can do it. It requires handling special cases of clicking a header which makes things less obvious. Some of this can be avoided if you derive the grid and override virtual methods instead of trying to do things through events. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_cbc3f75c.zip

Administrator [Syncfusion]
Replied On October 20, 2005 07:17 AM

Hi Clay, Actually you gave me this link for solving my problem.In this example I modified some things so that it suits to my requirement.Modifiction is nothing but I adjusted the queueRectangle dimensions,so that it comes as a small rectangle.Now my question in the example you are just filling the queueRectangle,but not drawing the rectangle.If i fill the queueRectanlge with LightYellow, I want border for that,I created same graphics object and wrote g.DrawRectangle,but on moving the cursor that rectangle is not erasing,its due to painting is slow or for some othe reason.I wrote code ClearQueue as this(g.DrawRectangle(Pens.Snow,queueRectangle.X,queueRectangle.Y,queueRectangle.Width,queueRectangle.Height);) .I have taken so that it wont be visible.Kindly give me the solution.Finally i want a visible border to rectangle like EXCEL. Thanks in advance, Thanks & Regards, Manohar B. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_d1855a6.zip

Administrator [Syncfusion]
Replied On October 20, 2005 10:54 AM

I do not see any changes in the file you uploaded from the one I sent you. I do not see any yellow drawing in it. The code I sent you draws a line at the top of the selection. If you simpley modify it to fill rectangles on four sides of the selection, then it seems to work OK. http://www.syncfusion.com/Support/user/uploads/GDBG_Delete_e5c3e63e.zip Select a few rows by dragging the row headers, an dthen mouse down on a selected header to start the drag and see the full rectangle.

Administrator [Syncfusion]
Replied On October 21, 2005 02:21 AM

Hi Clay, Sorry clay last time I didn''t attached the midified version,now i am attaching it.I commented my code with lines "//My code start" and "//My code end".I am drawing a border to the rectangle, but while moving how to erase that border, i want that. Thanks in advance, Thanks & Regards, Manohar B.

GDBG_Delete_d1855a60.zip

Administrator [Syncfusion]
Replied On October 21, 2005 03:11 AM

What is wrong with the sample I sent you that draws the destination rectangle? There are drawing glitches when you hit the top and bottom borders and auto scroll kinks in, but these can be worked around.

Administrator [Syncfusion]
Replied On October 21, 2005 03:34 AM

In your sample, the rectangle that is being invalidated is not big enough. That is why you are seeing the remnants left. private void ClearQueue() { queueRectangle.Inflate(2,2); this.gridDataBoundGrid1.Invalidate(queueRectangle); this.gridDataBoundGrid1.Update(); queueRectangle = Rectangle.Empty; }

Administrator [Syncfusion]
Replied On October 21, 2005 04:09 AM

Hi Clay, Thanks a lot for giving me this simple soltion.The one which you gave earlier also will solve my problem but I need to customise so much code.Thanks a lot once again for your immediate response. Thanks & Regards, Manohar B.

Administrator [Syncfusion]
Replied On October 27, 2005 01:40 AM

Hi Clay, continuing the discussion from the above given(not just one above, the zip file and everything) code,this has got any impact on resizing of cells.If so pls advice me how to overcome that problem. Thanks in advance, Thanks & Regards, Manohar B.

Administrator [Syncfusion]
Replied On October 27, 2005 03:28 AM

I do not understand. Exactly what sample do I use? Exactly what steps do I take in the sample to see the problem to see your problem?

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.

;