REBOL 3.0

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.

9 Comments

REBOL 3.0
Updated 22-Apr-2017 - Edit - Copyright REBOL Technologies - REBOL.net