Hi everyone,
I am having some trouble with the TreeView in gtk2hs.
(I am using gtk2hs 0.12.3 with ghc 7.4.2 on windows 7 x64.)
I would like to achieve the following: in 1 set up the TreeView and its
columns and
renderers, and in a different function set the model for the TreeView control so
the data can be displayed. I have the following code:
populateTreeView :: TreeView -> IO ()
populateTreeView tv = do
list <- listStoreNew [["Vince", "1"], ["Jhen", "2"], ["Chris", "3"],
["Sharon", "4"]]
treeViewSetModel tv list -- this call throws warnings saying that the
model is different from the
-- one that was used in the function below.
setupTreeView :: TreeView -> IO ()
setupTreeView treeview = do
model <- treeStoreNew ([] :: [Tree String])
widgetSetSizeRequest treeview 300 (-1)
renderer <- Model.cellRendererTextNew
col <- Model.treeViewColumnNew
Model.treeViewColumnSetTitle col "Upcoming Birtdays"
Model.cellLayoutPackStart col renderer False
Model.cellLayoutSetAttributes col renderer model -- My problem is here I
need to supply a model.
$ \l -> [Model.cellText := l] -- Is there a function
I can use to define how
-- a cell is rendered
without supplying the model?
Model.treeViewAppendColumn treeview col
After looking at the source code, it seems that the
'gtk_tree_view_column_set_attributes'
function is not exposed in gtk2hs because of variable argument list FFI
restriction.
Is there a way to work around this problem?
Regards
Rouan.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel