How to cancel drop after user prompt

4 posts, 0 answers
  1. Eli Schleifer
    Eli Schleifer avatar
    5 posts
    Member since:
    Jul 2009

    Posted 13 Jul 2009 Link to this post

    I would like to provide a drag drop mechanism where after the mouse is released over the target (indicating the drop shuld proceed) I can prompt the user with a messagebox say - Drop Here? And allow the user to cancel the action. What events/methods should I be keyeing off of to achieve this.

    Thanks
  2. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 13 Jul 2009 Link to this post

    Hi Eli Schleifer,

    Given that you have the rest of the DragDrop working (I could help you with this if you need), then you will most probably be doing something in the DragInfo handler with DragComplete status, lets say removing the item from the source object. Then probably you will be adding the dragged item(s) in the DropInfo handler  - with DropComplete status.

    What you could do is build an object that has delegates pointing to anonymous functions that do what you will normally do in the Drag/Drop info handlers. You can build this object in the Drag/Drop handlers and remember this object somewhere (also as a payload of the DragDrop). Then on drop info you show the user prompt and execute the actions only if they were confirmed. I suggested lambda (anonymous) functions because you could easily transform existing code into them, of course you could approach it differently.

    Implementing this may not be trivial so please come back to us if you need an example or more clarification.

    Best wishes,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. DevCraft banner
  4. Eli Schleifer
    Eli Schleifer avatar
    5 posts
    Member since:
    Jul 2009

    Posted 13 Jul 2009 Link to this post

    From what I can tell the OnDropInfo event is fired frequently even while just hovering over a drop area...which is why I sent out this inquiry. I don't see any specific status code from the time of doppossible to dropcomplete or a wat to cancel the Drop once DropComplete Info is sent.

    If you could put together a small sample that would be much appreciated.

    Thanks
    Eli
  5. Miroslav
    Admin
    Miroslav avatar
    922 posts

    Posted 15 Jul 2009 Link to this post

    Hi Eli,

    Yes, I created an example and I have attached it to this reply.

    Please note that the sample implementation is aimed at reducing the code change from an existing drag-drop implementation. You just need to change the payload with a custom class, wrap the current drag/drop info handlers in actions and make sure you use the new payload.

    Certainly there can be other implementations but I hope this one is simple and easy to use.

    Hopefully you will be able to use the example,

    All the best,
    Miroslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top