none
AfterDragDropOnSlide event in PPT 2013 RRS feed

  • Question

  • Hi,

    Please explain with an example, the ppt 2013 event - AfterDragDropOnSlide. What is used for?

    I tried with this event. This doesn't seems to work.

    Thanks for the reply.

    Regards,

    Bala.

    Friday, April 11, 2014 5:21 PM

All replies

  • I would be interested in the same question.

    UPDATE: I found a solution. I tried to drag&drop by calling the Windows Forms DoDragDrop method, but that didn't trigger the said event. So I started to experiment by passing an IDataObject as the first parameter and observed that when dropped onto a slide, PowerPoint called the GetDataPresent method by passing "PowerPoint Drop Trigger" as the format parameter.

    So I tried to return true if the parameter was "PowerPoint Drop Trigger", and this suddenly made the AfterDragDropOnSlide method get called.

    The relevant code:

    // The IDataObject implementation, this was used to experimentation.
    class TestDataObject : IDataObject
    {
    	public object GetData(Type format)
    	{
    		return "test";
    	}
    
    	public object GetData(string format)
    	{
    		return "test";
    	}
    
    	public object GetData(string format, bool autoConvert)
    	{
    		return "test";
    	}
    
    	public bool GetDataPresent(Type format)
    	{
    		return true;
    	}
    
    	public bool GetDataPresent(string format)
    	{
    		return true;
    	}
    
    	public bool GetDataPresent(string format, bool autoConvert)
    	{
                    // NOTE: This is the important part!
    		return format == "PowerPoint Drop Trigger";
    	}
    
    	public string[] GetFormats()
    	{
    		throw new NotImplementedException();
    	}
    
    	public string[] GetFormats(bool autoConvert)
    	{
    		return new[] {"Text"};
    	}
    
    	public void SetData(object data)
    	{
    		throw new NotImplementedException();
    	}
    
    	public void SetData(Type format, object data)
    	{
    		throw new NotImplementedException();
    	}
    
    	public void SetData(string format, object data)
    	{
    		throw new NotImplementedException();
    	}
    
    	public void SetData(string format, bool autoConvert, object data)
    	{
    		throw new NotImplementedException();
    	}
    }
    
    ...
    
    // Calling DoDragDrop in a user control.
    this.DoDragDrop(new TestDataObject(), DragDropEffects.Copy);

    I would be very much interested in whether it is possible to achieve the same thing in PowerPoint 2010.


    UPDATE 2: I just realised this was posted in the VBA forum, I am not sure that this will help in VBA, but I leave the answer here, hopefully the same concept can be applied there as well.
    • Edited by Mark Vincze Tuesday, April 29, 2014 7:10 AM
    Monday, April 28, 2014 1:46 PM