I have some problems understanding how to use the toggle buttons to bind GTK + to Haskell.
What I want to do is display treeViewwith two columns: one contains rows, and the other contains toggle buttons. The user must mark the switch buttons to select the inputs that he wants to use in another part of the program.
My model is a list of tuples (String,Bool)whose logical value should reflect the state of the toggle button. Initialy, all False.
Here is my code:
treeview <- builderGetObject builder castToTreeView "diffDisplayTreeView"
treeviewselect <- treeViewGetSelection difftreeview
dcolumn <- builderGetObject builder castToTreeViewColumn "dcolumn"
selcolumn <- builderGetObject builder castToTreeViewColumn "selcolumn"
dcell <- builderGetObject builder castToCellRendererText "dcell"
selcell <- builderGetObject builder castToCellRendererToggle "selcell"
[...]
store <- listStoreNew modelFromSomewhereElse
cellLayoutSetAttributes dcolumn dcell store $ \x -> [cellText := fst(x)]
cellLayoutSetAttributes selcolumn selcell store $ \x -> [cellToggleActivate := snd(x)]
treeViewSetModel treeview store
treeView, , , . cellToggled , , treeView.
:)