[openbeos] Re: drag-and-drop

  • From: "Jonas Sundstrom" <kirilla@xxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 25 Mar 2003 19:43:29 +0100 CET

Alexander G. M. Smith wrote:
> Ben Allen wrote on Mon, 24 Mar 2003 16:56:00 GMT:
 ...
> > When a file is dragged from the desktop or the 
> > tracker onto an application icon, what information is 
> > sent to the target application, and what format is it in? 
 ...
> http://bang.dhs.org/be/bebook/Drag%20and%20Drop/DragNDrop.html
 ...
> What=B_SIMPLE_DATA
 ...
> B_REF_TYPE            "refs"                   
>  File: /boot/var/tmp/default.dat

(there is a better place for this: bedevtalk@xxxxxxxxxxxxx)

These (Q and A) are two separate cases.

B_SIMPLE_DATA is what your BWindow or BView receives 
when a file is dropped on your app's window. (already running)
You catch this in BView::MessageReceived(), IIRC.

B_REFS_RECEIVED is what your BApplication object receives
in BApplication::RefsReceived() when you either
* drop a file on the app's icon, in Tracker
* select a file in your BFilePanel (of the B_OPEN_PANEL variety)
* select a file in Tracker and Open with -> YourApp

In both cases, the received BMessage contains references to 
the file(s), in the form of entry_ref structs, which you can use
to construct Storage Kit objects like BFile, BPath, etc.

The two cases are separate in that you can drop files of any 
kind on the app's windows, whereas Tracker will only let you 
drop files the app has listed support for, on the app's icon. 
(You can force it though, by pressing Control)

/Jonas Sundström.                       www.kirilla.com


Other related posts: