Re: Drag'n'Drop : Dragging a file into an app
- From: "Chris Uppal" <chris.uppal@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 20 Aug 2005 08:44:17 +0100
Rob,
> I'm looking for some help. I was wondering if anyone could point me to an
> example of how enable dragging files into an app. I can get dragging of
> objects from one shell to another running - but not from a non Dolphin
> source.
That functionality isn't exposed in vanilla Dolphin, so you'll need an
extension. I use Louis and Steve's 'DH Shell Data Transfer' package which is
part of their 'Shell' project at:
http://www.dolphinharbor.org/dh/projects/shell/index.html
To use it, do something like:
ShellDragDropSession registerDropTarget: each view.
for each of the presenters you want to be 'active'. I do that in my main
Shell's #onViewOpened. Similarly you need to call:
ShellDragDropSession revokeDropTarget: each view.
in your #onViewClosed.
Unfortunately, I don't know of any way to make the whole window, including
sub-panes, be 'active' except my looping over them. A Windows thing...
With that in place, the "normal" Dolphin drag-and-drop stuff is hooked into the
Windows stuff (as a drop target, I don't know whether it's also possible to
make it a drag source as easily). You'll also (as normal) have to make the
relevant Views be
#isDropTarget: true
either in the view composer or from code. And you'll have to register interest
in the #dragOver: and #drop: events triggered off the relevant Presenters (not
their Views), which is also as per normal.
Files dropped into the app show up as objects with format #Filenames (note the
plural -- the object is a collection of filenames) in the DragDropSession.
I've found one problem with it, which may be because I'm not using it quite
right (so beware ;-) When the image is saved and restarted, the connection to
Windows is implicitly revoked (obviously) so ShellDragDropSession attempts to
reconnect automatically, but that doesn't (for me anyway) seem to work
properly. I haven't found a workaround for it (simply hooking image startup
from my Shell to reconnect then doesn't work since that interferes with
ShellDragDropSession's own attempt). But since it is irrelevant to deployed
applications, and I don't often close down my image anyway, I haven't worried
too much about it.
-- chris
.
- Follow-Ups:
- References:
- Drag'n'Drop : Dragging a file into an app
- From: Rob Lally
- Drag'n'Drop : Dragging a file into an app
- Prev by Date: Q regarding the model in ChoicePresenter / ChoicePrompter
- Next by Date: Re: Q regarding the model in ChoicePresenter / ChoicePrompter
- Previous by thread: Drag'n'Drop : Dragging a file into an app
- Next by thread: Re: Drag'n'Drop : Dragging a file into an app
- Index(es):
Relevant Pages
|