GtkComboBox ? in Gtk+-2.3
- From: Stephane Wirtel <stephane wirtel belgacom net>
- To: gtk-devel-list gnome org, gtk-list gnome org
- Subject: GtkComboBox ? in Gtk+-2.3
- Date: Fri, 24 Oct 2003 12:18:08 +0200
Hi all,
I test the new GtkComboBox widget for a project.
But i have a problem, the items on this GtkComboBox are hidden, and i
don't know why.
Here is my source code, it's a small code, can you check it and send me
the right way to use GtkComboBox.
Thanks,
Stephane
#include <glib.h>
#include <gtk/gtk.h>
gchar *data[] =
{
"Item 1", "Item 2", "Item 3", NULL
};
GtkTreeModel *create_model(void)
{
GtkListStore *store;
GtkTreeIter iter;
guint i;
store = gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING);
for ( i = 0 ; data[i] != NULL; i++ )
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, i,
1, data[i],
-1);
}
return GTK_TREE_MODEL(store);
}
gint main(gint argc,
gchar **argv)
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *combo_box;
GtkTreeModel *model;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window), "destroy", gtk_main_quit, NULL);
gtk_widget_set_size_request(window, 100, 50);
model = create_model();
if ( model != NULL )
{
combo_box = gtk_combo_box_new(model);
gtk_container_add(GTK_CONTAINER(window), combo_box);
}
gtk_widget_show_all(window);
gtk_main();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]