I would like to know how to use the following events handlers : dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter,

WxHaskell and DragAndDrop I would like to know how to use the following events handlers : dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter, dropTargetOnDragOver….[1] Could you check if my current believes are corrects : From wx Widgets/ wxPython [2] / [3] / [4] it looks like they need to be used to manage DragAndDrog for non trivial examples. they are not actionable via an existing event like "on drag", etc.. I tried and create my own event. but it does not get "activated". [7] besides, from the signatures [1], these look like being activated on DropTarget, unlike other events on Reactive/ Windows/Controls . Is It Correct ? Heinrich created its own events "onText", (in reactive-Banana) but this is on a Control. [6] Could someone confirm these events effectively worked for them in WxHaskell, and maybe hint how to do that [1]: from Graphics.UI.WXCore.Events , line 1933 onwards Set an event handler that is called when the drop target can be filled with data. This function require to use 'dropTargetGetData' in your event handler to fill data. dropTargetOnData :: DropTarget a -> (Point -> DragResult -> IO DragResult) -> IO () ... -- | Set an event handler for an drop command in a drop target. dropTargetOnDrop :: DropTarget a -> (Point -> IO Bool) -> IO () -- | Set an event handler for an enter command in a drop target. dropTargetOnEnter :: DropTarget a -> (Point -> DragResult -> IO DragResult) -> IO () -- | Set an event handler for a drag over command in a drop target. dropTargetOnDragOver :: DropTarget a -> (Point -> DragResult -> IO DragResult) -> IO () -- | Set an event handler for a leave command in a drop target. dropTargetOnLeave :: DropTarget a -> (IO ()) -> IO () [2] : http://docs.wxwidgets.org/2.8/wx_wxdroptarget.html#wxdroptargetondrop [3] : http://wiki.wxpython.org/DragAndDrop [4] : http://www.blog.pythonlibrary.org/2012/06/20/wxpython-introduction-to-drag-a... [5] : http://wewantarock.wordpress.com/2011/06/17/how-does-wxhaskell-event-handlin... [6] : https://github.com/HeinrichApfelmus/reactive-banana/blob/master/reactive-ban... L 88 [7] : module Main where import Graphics.UI.WX hiding (empty) import Data.Maybe import Control.Monad import Graphics.UI.WX.Events import Graphics.UI.WXCore.WxcClassesMZ --import Graphics.UI.WXCore.WxcClassesAL import Graphics.UI.WXCore.DragAndDrop import Graphics.UI.WXCore.Events main = start dndtest dndtest = do f <- frame [text := "Drag And Drop test"] p <- panel f [] ok <- button p [text := "Ok"] xinput <- textEntry p [text := "here :"] --textEntry yinput <- staticText p [text := "drag me"] zinput <- staticText p [text := "result me"] set f [defaultButton := ok ,layout := container p $ margin 10 $ column 5 [boxed "coordinates" (grid 5 5 [[label "source:", hfill $ widget yinput] ,[label "target(focus first):", hfill $ widget xinput] ,[label "result:", hfill $ widget zinput] ]) ,floatBottomRight $ row 5 [widget ok]] ] set xinput [ on enter := onEnter] set yinput [ ] --------------------------------------------------------- --- meaningful stuff starts here --------------------------------------------------------- -- prepare the drop source : create a DataObject and associate it with the source textdata' <- textDataObjectCreate "text dropped" src <- dropSource textdata' yinput -- prepare the drop target: create a DataObject (placeholder here) and associate it with the target textdata <- textDataObjectCreate ".." drop <- dropTarget xinput textdata set drop [ on onMyDrop := showMeDrop ] ---- <<<< I am expecting this to get fired but no ... -- obj create a new event on drop invoking .. -- and see if it is invoked set yinput [ on drag := onDrag src ] set xinput [ ] ------ <<<< I am expecting the target to react when dropped (Its DroopedTarget i fact) set zinput [ on mouse := showMeE] set ok [ on command := close f ] return () --- this is the custom event, just a setter to fire dropTargetOnDrop. not sure at all this is the correct way. onMyDrop = newEvent "onmyDrop" (\w -> ioError (userError ("attribute '" ++ "onmyDrop" ++ "' is write-only."))) dropTargetOnDrop --dropTargetOnDrop :: DropTarget a -> (Point -> IO Bool) -> IO () --- the rest are jsut helper to see whats going on showMeEo = putStr "showMeEo" showMeDrop p = do putStr "showMeDrop" return True onDrag s p = do -- dragAndDrop :: DropSource a -> DragMode -> (DragResult -> IO ()) -> IO () dragAndDrop s Default (\r -> do {putStr "DnD handler called: "; putStrLn(show r); return ()}) putStrLn "on Drag activated:" showMeE :: EventMouse -> IO () showMeE (MouseMotion point mod) = putStr "" --- discard meaningless Motion event showMeE e = putStrLn $ show e -- onEnter p = putStrLn $ "on Enter:" ++ show p http://stackoverflow.com/questions/15911219/wxhaskell-and-draganddrop-how-to...

On Tue, 09 Apr 2013 21:54:15 +0200, Luc TAESCH
WxHaskell and DragAndDrop
I would like to know how to use the following events handlers : dropTargetOnData, dropTargetOnDrop, dropTargetOnEnter, dropTargetOnDragOver….[1]
Could you check if my current believes are corrects :
From wx Widgets/ wxPython [2] / [3] / [4] it looks like they need to be used to manage DragAndDrog for non trivial examples. they are not actionable via an existing event like "on drag", etc.. I tried and create my own event. but it does not get "activated". [7] besides, from the signatures [1], these look like being activated on DropTarget, unlike other events on Reactive/ Windows/Controls . Is It Correct ?
Heinrich created its own events "onText", (in reactive-Banana) but this is on a Control. [6]
Could someone confirm these events effectively worked for them in WxHaskell, and maybe hint how to do that
I have tried you attached program and it gave the following tracing:
Drag.exe showMeDropDnD handler called: DragMove on Drag activated: on Enter:Point {pointX = 24, pointY = 6}
Build info: - Windows XP - GHC version 7.4.2 - wxWidgets-2.9.3 - wxHaskell from https://github.com/atzedijkstra/wxHaskell As no one else has responded so far, I think you are in uncharted territory; wxHaskell is huge and there are not many applications using it. If you have figured it all out, I hope you want to write a HaskellWiki page about it. Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --

If you have figured it all out, I hope you want to write a HaskellWiki page about it.
If I pass the gating, I ll publish a kind some HowTo on the differente techniques I dig out already started with this one, where I published my finding in the answer: http://stackoverflow.com/questions/15867654/wx-haskell-drag-and-drop-example
As no one else has responded so far, I think you are in uncharted territory; wxHaskell is huge and there are not many applications using it.
good point. ! do we have some kind of census of application that wrok or still work with wxhaskell ? any interest in (me) doing this ? (who know some toosl to do this, a la doodle ?) and by extension : btw how many people are really active and resonably knowleadeable these day ? (e.g. "senior") Are Eric ? Jeremy ? atzedijkstra ? yourself ? still active on wx. and are you using it yourself HenkJan ? is : https://github.com/atzedijkstra/wxHaskell the head dev for these day ? i.e. who is the maintainer ? ( Sorry for all these questions, but I am just discovering the field :-)

On Fri, 12 Apr 2013 14:47:23 +0200, luc taesch <
As no one else has responded so far, I think you are in uncharted territory; wxHaskell is huge and there are not many applications using it.
good point. !
do we have some kind of census of application that wrok or still work with wxhaskell ?
There are applications listed at http://wxhaskell.sourceforge.net/applications.html See also: http://packdeps.haskellers.com/reverse/wx
any interest in (me) doing this ? (who know some tools to do this, a la doodle ?)
I prefer the HaskellWiki
and by extension :
btw how many people are really active and reasonably knowledgeable these day ? (e.g. "senior") Are Eric ? Jeremy ? atzedijkstra ? yourself ? still active on wx. and are you using it yourself HenkJan ?
is : https://github.com/atzedijkstra/wxHaskell the head dev for these day ? i.e. who is the maintainer ?
Atze Dijkstra and I are currently doing maintenance on wxHaskell, using the GitHub repository you mentioned; the previous maintainers have done a lot of good work, but seem to have different priorities now. You can see, from the uploaders of the wxHaskell using packages, who worked with wxHaskell. I did some updating on wxHaskell applications (GeBoP, wxAsteroids) and developed some games (not online yet). Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html Haskell programming --
participants (3)
-
Henk-Jan van Tuyl
-
luc taesch
-
Luc TAESCH