Re: Problems with GtkComboBoxEntry





Martyn Russell ha scritto lo scorso 05/10/2004 11:03:
On Thu, 2004-09-30 at 17:27, Carlo Agrusti wrote:

Hi all,

I'm trying to use GtkComboBoxEntry widgets and I'm facing the following issue (gtk-2.4.10):

If I (using Glade) create a GtkComboBoxEntry with gtk_combo_box_entry_new () and then try to set a model for the combo with the following code:

  list = gtk_list_store_new (1, G_TYPE_STRING);
  gtk_list_store_append (list, & iter);
  gtk_list_store_set    (list, & iter, 0, "pippo", -1);
        
  gtk_list_store_append (list, & iter);
  gtk_list_store_set    (list, & iter, 0, "pipino", -1);
        
  gtk_list_store_append (list, & iter);
  gtk_list_store_set    (list, & iter, 0, "peppuccio", -1);
        
  gtk_combo_box_set_model (GTK_COMBO_BOX (cbox), GTK_TREE_MODEL (list));

I have my combo with three *empty* entries; setting a model for a GtkComboBoxEntry only works with combos generated with gtk_combo_box_entry_new_with_model. Am I missing something or there is a typo in gtk_combo_box_entry_new documentation?


Are you using glade to set up the GtkComboBoxEntry in the first place?


Yes, I am (at least in the beginning); but this behaviour does not depend on Glade. Glade can use both gtk_combo_box_entry_new and gtk_combo_box_entry_new_text, choosing the former if you don't enter a list of selections and the latter if you do. In the first case (gtk_combo_box_entry_new) there is no way to set a model for the combo_box_entry; by using gtk_combo_box_entry_new_text things go fine, and you can set a new model for the widget (of course destroying the original set of selections) and this is the workaround I am currently using.


I recently reported a bug
(http://bugzilla.gnome.org/show_bug.cgi?id=154191) that might be related
to your problem.

I don't know, I got no gtk-CRITICAL, but entries are empty.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]