Thank you!

Finally I figured out how to bring DND to life. I do not know what are
the TargetLists for but it works the same with them and also without
them. Here is a code snipset:

 -- new game button
 buttonNewGame <- buttonNewWithLabel "New Game"
 onClicked buttonNewGame (newGame buttonNewGame)
 boxPackStart vboxButtons buttonNewGame PackGrow 0

 -- quit button
 buttonQuit <- buttonNewWithLabel "Quit"
 onClicked buttonQuit mainQuit
 boxPackStart vboxButtons buttonQuit PackGrow 0

 -- DND
 dragSourceSet buttonNewGame [Button1] [ActionCopy]
 dragDestSet buttonQuit [DestDefaultAll] [ActionCopy]

 dragSourceAddTextTargets buttonNewGame
 dragDestAddTextTargets buttonQuit

 buttonQuit `on` dragDataReceived $ \ ctx p ii ts -> do liftIO (putStrLn "data-received")
                                                                             d <- selectionDataGetText
                                                                             liftIO (putStrLn ("data are: " ++ (show d)))
                                                                             return ()

 buttonNewGame `on` dragDataGet $ \ ctx ii ts -> do
        liftIO (putStrLn "data-get")
        selectionDataSetText "hahaha"
        return ()

On Mon, Aug 24, 2009 at 5:45 PM, Michael Dever <> wrote:

On Mon, Aug 24, 2009 at 4:19 PM, Bulat Ziganshin <> wrote:
Hello frantisek,

Monday, August 24, 2009, 6:53:03 PM, you wrote:

(i rerouted asnwer to gtk2hs list)

> Hi, have somebody used drag and drop feature of Gtk2hs? I can't find
> any tutorial or demo. I'm using only the documentation but I think I'm 
> missing something. Can anyone give me an example?

Yeah, I used DND in my file manager, I think there might be a code example on my blog but I'm not 100% sure.

I'll have a look later and get back to you with an example. I found the one included with gtk2hs quite confusing :)

there is filemanager program mentioned in gtk2hs news that supports

btw, i also have question regarding d&d - does it work only inside
gtk2hs/gtk programs or it's possible to d&d between Windows Explorer
and my program? i'm writing filemanager too ;)
I'd say there is maybe a way to get transferance between gtk apps, but I think at this stage using gtk2hs it would be a nightmare, I remember writing the DND and finding it very hacky. Then again I may have done it wrong!

You would have to know what was being dropped/dragged, and have a means of accepting it and handling it.

It would be interesting though :)