Migrating from GtkOptionMenu to GtkComboBox



Hi,

I use the lovely devhelp for browsing GTK documentation and 
I think it's necessary to add another code example in :
GTK+ Reference Manual
-> Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and    
GtkComboBoxEntry

after the combo_box_new_text example, you can add something like that

void changed_combo_box_cb (GtkWidget *combo_box,
			   gpointer user_data)
{
	GtkTreeModel *model;
	GtkTreeIter iter;

	model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
	
	if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX(combo_box), &iter)) {
		gchar *string;

		gtk_tree_model_get (model, &iter, 0, &string, -1);
		g_print("%s", string);
		g_free(string);
	}	
}

Regards,

Stephane




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