[Haskell] Problem with comboBox

L. J. djsenda at gmail.com
Mon Aug 14 19:05:12 EDT 2006

On 8/15/06, Duncan Coutts <duncan.coutts at worc.ox.ac.uk> wrote:
> On Mon, 2006-08-14 at 20:36 +0200, L. J. wrote:
> >  I have send this mail to the gtkhs at haskell.org mailing list. I do not
> > know if this list is active, so I reply the mail in this one. If the
> > other list is active, I'm sorry.
> No problem. :-)
> The gtkhs at haskell.org mailing list was for the now defunct GTK+HS
> project. The successor project which it looks like you've been using is
> Gtk2Hs.
> It's mailing lists are listed here:
> http://haskell.org/gtk2hs/development/#mailing_lists
> So you'd want
> gtk2hs-users at lists.sourceforge.net

 Thanks you very much for the links. I`m sorry I do not know that.

> >  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?
> Sadly not, in Glade it allows you to create a general ComboBox. The
> comboBoxNewText convenience functions can only be used in the code, not
> from Glade.
> > I can do I want by another method?
> So there are two things you can do. One is to use the general interface
> which means creating your own model which will hold the data you want to
> display. If you want to display anything more complex in the combo box
> than simple strings then this is the only method to choose.
> However I just realised that with the current Gtk2Hs releases we didn't
> bind quite enough functions for you to use a non-trivial model with a
> ComboBox. We'll fix that for the next release.
> So as Piotr suggested, you should create the combobox in code with
> comboBoxNewText rather than in glade and then that to the right place in
> the gui constructed with glade.
> For example:
> box <- xmlGetWidget xml castToBox "box1"
> combo <- comboBoxNewText
> containerAdd box combo
> widgetShow combo

 Thanks you, it lack me the 'containerAdd' function.

> I'd like to note that the next release of Gtk2Hs will make it much much
> easier to create data models to use with views like the TreeView and
> ComboBox.
> Duncan

More information about the Haskell mailing list