From: Daan L. <daa...@xs...> - 2004-05-19 08:59:31
|
Hi alias in space and time :-) On Tue, 18 May 2004 23:31:00 -0500, <wxh...@al...> wrote: > Continuing with my last example, I have been trying to get drag and drop > working for trees. Is this implemented yet? The following doesn't seem > to work with or without the "veto" line commented out. Any guidance > would be appreciated. If it hasn't been implemented yet, how much work > would be required to do so? Well, when I tried your example, it first crashed on me! As I am using a debug version, I quickly found out that the wxWidget code asserts that an image list is present when dragging -- even when just using text labels :-( I just wonder whether that might cause you trouble. When I added images (using the filebrowse example images) everything worked -- of course, drags were vetoed so, nothing would happen. I hope this helps, All the best, Daan. > > Thanks > > module Main where > > import Graphics.UI.WX > import Graphics.UI.WXCore > > imageNone :: Int > imageNone = (-1) > > appendChild tree parent child = treeCtrlAppendItem tree parent child > imageNone imageNone objectNull > > appendList tree parent children = mapM_ (appendChild tree parent) > children > > main :: IO() > main = start test > > test :: IO() > test = do f <- frame [text := "Hello!"] > tree <- treeCtrl f [] > root <- treeCtrlAddRoot tree "Root" imageNone imageNone > objectNull > child1 <- treeCtrlAppendItem tree root "Child1" imageNone > imageNone objectNull > child2 <- treeCtrlAppendItem tree root "Child2" imageNone > imageNone objectNull > appendList tree child1 ["A","B","C"] > appendList tree child2 ["1","2","3"] > set tree [on treeEvent := onTreeEvent tree] > set f [layout := fill $ widget tree, clientSize := sz 500 300] > > > onTreeEvent :: TreeCtrl a -> EventTree -> IO () > onTreeEvent t event > = case event of > TreeBeginDrag item point veto > -> do putStrLn "started dragging..." > veto > propagateEvent > TreeEndDrag item point > -> do putStrLn "stopped dragging..." > propagateEvent > other > -> propagateEvent > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: SourceForge.net Broadband > Sign-up now for SourceForge Broadband and get the fastest > 6.0/768 connection for only $19.95/mo for the first 3 months! > http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click > _______________________________________________ > wxhaskell-users mailing list > wxh...@li... > https://lists.sourceforge.net/lists/listinfo/wxhaskell-users > |