当我运行此程序时,treeWiew小部件显示为白色背景,没有别的。我想,这是一个错误,但我不确定。我不想报告一个不是bug的bug。
testTree :: Tree String
testTree =
(Node "root"
[(Node "child"
[(Node "rose" []),
(Node "cry"
[(Node "karma" [])])]),
(Node "future" []),
(Node "destiny"
[(Node "call" []),
(Node "saw" [])]),
(Node "reason" [])])
start :: IO ()
start =
builderNew >>= (\builder ->
builderAddFromFile builder "graphic.glade" >>
builderGetObject builder castToWindow "mainWindow" >>= (\window ->
widgetShowAll window >>
windowMaximize window >>
(window `on` deleteEvent) (liftIO (widgetDestroy window >> mainQuit >> return True))) >>
builderGetObject builder castToTreeView "treeView" >>= (\tv ->
treeStoreNew [testTree] >>= (\ts ->
treeViewSetModel tv ts)) >>
return ())
gtkmain :: IO ()
gtkmain =
initGUI >>
start >>
mainGUI
main = gtkmain