how to drag'n'drop ?
[1/4] from: jason::cunliffe::verizon::net at: 1-Oct-2002 23:26
I just accidentally discovered a great drag'n'drop feature of MSIE6
Drag an image onto another brower window and bang it displays the cached
version. That makes it much faster when you want to save/email/whatever
no more fiddly right-mouse clicking.
Yesterday I was playing around with the wxPython demos. there's nice one with
drag'n'drop. I want this for rebol apps =>
-open a browsder
-drag an image onto rebol/view...
-zing upload to remote site
What is needed to do this in REBOL?
Would'nt it be sweet to have some of this in /View?
from wxPython.wx import *
#----------------------------------------------------------------------
class MyURLDropTarget(wxPyDropTarget):
def __init__(self, window):
wxPyDropTarget.__init__(self)
self.window = window
self.data = wxURLDataObject();
self.SetDataObject(self.data)
def OnDragOver(self, x, y, d):
return wxDragLink
def OnData(self, x, y, d):
if not self.GetData():
return wxDragNone
url = self.data.GetURL()
self.window.AppendText(url + "\n")
return d
http://wiki.wxpython.org/index.cgi/FrontPage
http://wiki.wxpython.org/index.cgi/DragAndDrop
./Jason
[2/4] from: anton:lexicon at: 2-Oct-2002 21:27
Maybe it would be possible through the
system port one day (I don't know of
any docs for it yet, I think it's not
really ready in the latest betas.)
To do it now, I think you would need to
access external windows libraries to catch
window messages. That needs /View/Pro or /Command.
You can imagine that implementing drag&drop
between rebol and native os on all platforms
will be difficult, so it hasn't been done yet.
But you could help it happen by looking up
the windows API's required and some example
code, probably c++, that can allow this to
happen. It is possible for a Windows process
to hook in to another process' window and listen to
or modify the window messages that it receives.
So you could launch a separate process to listen
to your rebol window and wait for "drag-over" messages
or however it is done.
Anton.
[3/4] from: bry:itnisk at: 2-Oct-2002 15:37
Drag and Drop is handled via a DropHandler shell extension, this comes
from IDropTarget and also IPersistFile.
Here's a link to IDropTarget
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/oin
_d_95tg.asp
To set a DropHandler you use the registry:
HKEY_CLASSES_ROOT
\{filetype}
\ShellEx
\DropHandler
{filetype} does not specify the extension of a file but rather the type
of file it is, check HKEY_CLASSES_ROOT\batfile for an example wherein a
DropHandler can be found.
Since Command can use Dlls Shouldn't it be possible to make some simple
drag & dropping work?
Perhaps if we had a simple dll that implemented some various drag and
drop functions for .r files then Command could just call into that?
I think this might be an interesting thing for Command, a library of
dlls that are written to provide functionality for Rebol in things for
which it is somewhat weak. Just an idea.
[4/4] from: greggirwin:mindspring at: 2-Oct-2002 11:03
Bryan, et al
<<Drag and Drop is handled via a DropHandler shell extension, this comes
from IDropTarget and also IPersistFile.>>
AFAIK, REBOL doesn't support COM interfaces so that might be a bit tricky.
If someone had lots of time and low level COM experience it could probably
be done. Euphoria has a COM library, so REBOL could probably support one
too. The question is: Is it worth it? :) For me, I'd rather spend time on a
DnD system that worked between REBOL apps on all platforms.
View/Pro and Command support a system port which they say can be used to
catch WM_ messages, but it isn't doc'd anywhere yet. With that you could at
least catch WM_DROPFILES to support DnD from Explorer.
--Gregg