I want to create a ComboBox widget with this code:
void initGUI
window <- windowNew
...
cb <- comboBoxNewText
comboBoxAppendText cb "Option 1"
comboBoxAppendText cb "Option 2"
comboBoxSetActive cb 0
boxPackStart hb cb PackNatural 0
...
But this error appears:
Couldn't match type ‘[Char]’
with ‘text-1.2.2.0:Data.Text.Internal.Text’
Expected type: ComboBoxText
Actual type: [Char]
In the second argument of ‘comboBoxAppendText’, namely
‘"Secuencial"’
In a stmt of a 'do' block: comboBoxAppendText cb "Secuencial"
In the expression:
do { void initGUI;
window <- windowNew;
set
window
[windowTitle := "A title",
windowDefaultWidth := 1024, ....];
vb <- vBoxNew False 7;
.... }
I am just following this tutorial (http://www.muitovar.com/gtk2hs/chap4-2.html) and reading the docs (http://projects.haskell.org/gtk2hs/docs/gtk2hs-docs-0.9.12/Graphics-UI-Gtk-ModelView-ComboBox.html#v%3AcomboBoxInsertText)
How can i make it work?
Thanks in advance.
I recommend using the documentation on Hackage. The documentation you linked is probably a decade stale by now.
From that documentation, we have
You are passing
"Option 1"as theComboBoxTextargument. In vanilla Haskell, this is aStringrather than aText-- as the error says. You can eitherpacktheString, as inor turn on
OverloadedStringsto have this automatically done forStringliterals, as in: