From: Marcus P. <mar...@co...> - 2009-08-24 19:25:59
|
Hi! I just started to find my way around the ListView. I just wanted to print my selected row when I click my delete button, like this: answer <- dialogRun dialog case answer of ResponseCancel -> widgetDestroy dialog ResponseApply -> deleteButtonClicked view model ResponseDeleteEvent -> widgetDestroy dialog deleteButtonClicked treeview model = do selection <- treeViewGetSelection treeview selIter <- treeSelectionGetSelected selection case selIter of Nothing -> putStrLn "Nothing Selected" Just a -> printRow a where printRow iter = do row <- treeModelGetRow model iter putStrLn (show row) This compiles fine but if I select a row and click delete button, i get the error: user error (ListStore.getRow: iter does not refer to a valid entry) What is wrong with my Iter? Second of all after my delete button is pressed, the actions does not work anymore, do I have to call dialogRun again? Or am I all wrong? Many thanks Marcus |
From: Axel S. <Axe...@en...> - 2009-08-27 21:32:55
|
Hi Marcus, I'm not quite sure what's wrong. But I'm confused as to why you use treeModelGetRow. It seems that you use the modules under TreeList.* which are deprecated. Please only use the modules under TreeView and, in particular, listStoreGetValue to retrieve a row at a certain iterator. Cheers, Axel. On Aug 24, 2009, at 21:22, Marcus Pedersén wrote: > Hi! > I just started to find my way around the ListView. > I just wanted to print my selected row when I click my delete button, > like this: > > answer <- dialogRun dialog > case answer of > ResponseCancel -> widgetDestroy dialog > ResponseApply -> deleteButtonClicked view model > ResponseDeleteEvent -> widgetDestroy dialog > > deleteButtonClicked treeview model = do > selection <- treeViewGetSelection treeview > selIter <- treeSelectionGetSelected selection > case selIter of > Nothing -> putStrLn "Nothing Selected" > Just a -> printRow a > where printRow iter = do > row <- treeModelGetRow model iter > putStrLn (show row) > > This compiles fine but if I select a row and click delete button, i > get > the error: > user error (ListStore.getRow: iter does not refer to a valid entry) > > What is wrong with my Iter? > Second of all after my delete button is pressed, the actions does not > work anymore, do I have to call dialogRun again? Or am I all wrong? > > Many thanks > Marcus > > > ---------------------------------------------------------------------- > -------- > Let Crystal Reports handle the reporting - Free Crystal Reports > 2008 30-Day > trial. Simplify your report design, integration and deployment - > and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Gtk2hs-users mailing list > Gtk...@li... > https://lists.sourceforge.net/lists/listinfo/gtk2hs-users |