[Haskell-cafe] Gtk2hs multiple column TreeView with ListStore issue
Кирилл Березин
pechenie.k at gmail.com
Sat Mar 19 18:46:55 CET 2011
I cannot force GTK to render data in TreeView with ListStore model with
multiple columns through Haskell. I have the following code
addTextColumn view name =
do
col <- treeViewColumnNew
rend <- cellRendererTextNew
treeViewColumnSetTitle col name
treeViewColumnPackStart col rend True
treeViewColumnSetExpand col True
treeViewAppendColumn view col
prepareTreeView view =
do
addTextColumn view "column1"
addTextColumn view "column2"
--adding data here
Then I try to add some data, and there are problems. I tried these:
--variant 1 (data TRow = TRow {one::String, two::String}
model <- listStoreNew ([] :: [TRow])
listStoreAppend model $ TRow { one = "Foo", two = "Boo" }
treeViewSetModel view model
--variant 2
model <- listStoreNew ([] :: [[String]])
listStoreAppend model ["foo","boo"]
treeViewSetModel view model
--variant 3
model <- listStoreNew ([] :: [(String, String)])
listStoreAppend model ("foo", "boo")
treeViewSetModel view model
But in all cases I see the table with column header and one blank row
inserted. Any help will be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110319/c11f6894/attachment.htm>
More information about the Haskell-Cafe
mailing list