On 8/14/06, Piotr Kalinowski <pitkali@gmail.com> wrote:
On 14/08/06, L. J. <djsenda@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-Comb...) 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).
Regards, Piotr Kalinowski -- Intelligence is like a river: the deeper it is, the less noise it makes
Thanks Piotr for reply so faster. I have tried to do the two options (firstly the second, which I have not do anything good because the models' dificulty). Then the first, I tried and I can do almost I want, but I can not connect the hvox with the comboBoxNewText even I read the Duncan's answer. Thanks you two very much.