No BSD License  

Highlights from
Drag and Drop

4.0

4.0 | 5 ratings Rate this file 17 Downloads (last 30 days) File Size: 3.03 KB File ID: #16312
image thumbnail

Drag and Drop

by Raphael Austin

 

10 Sep 2007 (Updated 10 Sep 2007)

Drag and Drop to and from Matlab Figure

| Watch this File

File Information
Description

Example Drag and Drop in Matlab Figures from Windows Explorer or Other Apps

DrapDropTest creates a simple figure which shows the implementation of dnd using activex.
The microsoft RichtextCtrl.1 activex control is used to demonstrate dnd ability. The control
has several events to which matlab can respond, in particular the OLEDragDrop Event.

Type DragDropTest from the command line to test. Once the figure is
running try dragging a text file into either of 2 areas on the figure.
The upper portion will just populate a listbox with the names of files
that have been dragged into the bar above it. The lower box displays the
contents of any text file dragged into it. The bottom box also allows
text to be dragged from a text editor such as wordpad.

This example is not intended to be robust, so please feel free to use it,
but make sure to check over the code in detail to make sure it doesn't
break. I've just coded this quickly to demonstrate the property. Feel
free to email me with questions comments.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Works on Windows Platforms
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
23 Oct 2008 Raphael Austin  
17 Sep 2009 Alan

Great example. Now if I could figure out how to make this control invisible and cover an entire figure so you can drag-and-drop to anywhere...

13 Apr 2010 Lukas Rohr

ActiveX can't be used on other Operating Systems

23 Apr 2010 Raphael Austin

That's a ridiculous reason for a bad rating. If you can find a way to do it without ActiveX, then submit it. I'd love to use it. Be part of the solution.

26 Apr 2010 Alan Brooks

Agreed that Lukas's statement should be a comment, not a rating. I would also like to know a cross-platform way of doing it, but have found none to date.

24 Sep 2010 Y Mehta

I get the following error. Am I missing an activeX control? If yes, how to get it?

??? Error using ==> feval
Input PROGID does not represent an Activex control.
If this PROGID used to work before, please check vendor's
documentation for equivalent activex control progid.

Error in ==> actxcontrol>createControl at 240
        ctrl = feval(comstr, 'control', position, parent, '', filename, hwnd, licensekey,
        false,parent_string);

Error in ==> actxcontrol at 212
    hControl = createControl;

Error in ==> DragDropTest at 36
h1 = actxcontrol(ProgID, [pos(3)*.1 355 pos(3)*.8 20],f,{'OLEDragDrop',@ShowFileNameOnDrop});

24 Sep 2010 Alan  
19 May 2011 Peter Manley-Cooke  
13 Jan 2012 Ergon

Hi, I tried this but I get an error:
"Error using actxcontrol (line 185)
Control creation failed. Invalid ProgID 'RICHTEXT.RichtextCtrl.1' "

I am using R2011b

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
path Raphael Austin 22 Oct 2008 09:26:22
directories Raphael Austin 22 Oct 2008 09:26:22
files Raphael Austin 22 Oct 2008 09:26:22
drag and drop Raphael Austin 22 Oct 2008 09:26:22
dnd Raphael Austin 22 Oct 2008 09:26:22
richtextctrl Raphael Austin 22 Oct 2008 09:26:22
activex Raphael Austin 22 Oct 2008 09:26:22
41 examples Raady 03 Apr 2011 13:34:04
drag and drop Tomas 08 Jun 2011 07:34:40
files Nilimb 04 Jul 2011 16:28:53

Contact us at files@mathworks.com