Comments on: Drag and drop file

Carl Sassenrath, CTO
REBOL Technologies
12-Aug-2007 3:47 GMT

Article #0098
Main page || Index || Prior Article [0097] || Next Article [0099] || 9 Comments || Send feedback

Drag and drop of files into R3 windows now supported.

Here's a quick example, written at the lowest level (defining its own graphic objects and event handler -- soon enough this will be supported at a higher layer):

REBOL [Title: "Drop File Test"]

win: make gob! [text: "Test Window" offset: 100x100 size: 600x200]
append win gt: make gob! [
    size: win/size
    text: [bold "Drop a file on me, s'il vous plaît."]

system/view/event-port: ep: open [scheme: 'event]

ep/awake: func [event] [
    print ["EVENT:" event/type event/offset]
    switch event/type [
        close [quit]
        drop-file [
            repend gt/text ['newline form event/data]
            show gt
    tail? system/view/screen-gob

view win

Thanks to Richard Smolak (Cyphre) for research and example of the Win32 API functions.



13-Aug-2007 3:06:51
If I understand it correctly, this is OS level drag&drop support, right? If so, very cool! Drag&drop at VID level is a bit different thing and I hope styles will count with that, by defining some special handlers for that ...

Hopefully, at least under Windows, systray support will there be too, I just right now don't know, how R3 will aproach things not present on all platforms?

13-Aug-2007 5:41:20
Very good!

Could this feature be backported in R2 ?
13-Aug-2007 10:28:28
This is good news! Thanks Carl.
13-Aug-2007 10:31:32
I noticed the use of the new Rich Text Format. Bravo !!!

will have us the possibility of including sub-blocks of text with inheritance of the style properties to the sub-blocks ?

something like: [bold “bla bla” [red “i' m red”]]

14-Aug-2007 7:59:17
Now REBOL can be the DnD target. Can REBOL be DnD source as well?

While draging, can we change the cursor/icon to "Forbidden" to indicate the gob/face is not a compatible target?How do we identity the type of the draged data?
14-Aug-2007 9:40:29

I think there is a possibility to have various cursors in R3, even custom one. That possibility was not present in R2. But don't take it for granted, I am not part of alpha testing group, I just collect some "rumours" :-)

Cheers, Petr

John Niclasen
14-Aug-2007 9:47:16
I'm pretty sure, things like cursor image is in the open source part of R3. The goal is, that stuff that is OS-dependent will be open source.
14-Aug-2007 12:11:45
Pekr, It's an educated guess, not a rumor :)

I hope at least I can drag something from a REBOL/view app and drop it into another REBOL/View app. Since both sides are REBOL, that could be implemented as a REBOL/Service.
Carl Sassenrath
14-Aug-2007 14:48:49
Yes, it is OS DnD, and there is also VID DnD.

There is not yet "source DnD", but we would like to add that at some point.

Yes, we support all the mouse cursors and even custom full color with alpha transparency cursors. In fact VID changes the cursor now for various operations. Quite nice.

Post a Comment:

You can post a comment here. Keep it on-topic.


Blog id:



 Note: HTML tags allowed for: b i u li ol ul font span div a p br pre tt blockquote

This is a technical blog related to the above topic. We reserve the right to remove comments that are off-topic, irrelevant links, advertisements, spams, personal attacks, politics, religion, etc.

Updated 24-Mar-2017 - Edit - Copyright REBOL Technologies -