[Haskell] Problem with comboBox

Piotr Kalinowski pitkali at gmail.com
Mon Aug 14 15:28:41 EDT 2006

On 14/08/06, L. J. <djsenda at gmail.com> wrote:
> Hi, i'm making my first graphic interface program with Haskell. I use
> Glade and Gtk+2.0. I create an empty comboBox with Glade and I want to
> add items (strings) in run time (by means of the haskell code). I
> tried with the functions 'comboBoxAppendText' and 'comboBoxInsertText'
> (http://haskell.org/gtk2hs/docs/current/Graphics-UI-Gtk-MenuComboToolbar-ComboBox.html#t%3AComboBox)
> but I can not do anything for display the information I want. This
> functions require to work with a comboBox creates with the constructor
> comboBoxNewText (and I think this constructor is not the used by
> Glade). I can create it from Glade? I can do I want by another method?
> Thanks.

You have two options:

* In glade insert one-element, empty hbox (or vbox) instead of
combobox, and then in runtime create a box with comboBoxNewText and
add it into the hbox (or vbox). Now you can use comboBoxAppendText.

* In glade insert comboBox as you do it now and in runtime add a model
to that box (see attribute comboBoxModel). I am, however, not well
versed in haskell interface to gtk+ so I can't help you with a model
part (you can see how it is done for TreeView widget though).

Piotr Kalinowski
Intelligence is like a river: the deeper it is, the less noise it makes

More information about the Haskell mailing list