[9346] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Combo Box

daemon@ATHENA.MIT.EDU (Wesley Lemke)
Fri Oct 16 08:38:09 1998

From: Wesley Lemke <wesley@home.dwave.net>
To: gtk-list@redhat.com
Date: Fri, 16 Oct 1998 07:37:48 -0500 (CDT)
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com

I'm new to GTK and am trying to create a Combo Widget in a window.
I'm not sure if the problem is with how I create the Combo, or how I
create the list of strings that I want to put in the combo.  (Proboably
both :P).  Here is what I have so far.


#define WEEKS 17
GtkWidget *table1;
GtkWidget *combo;
GList *list
GString *string;
int i;

combo = gtk_combo_new ();
list = g_list_alloc();

for(i = 0; i < WEEKS; i++)
{
	string = g_string_new("Week ");
	string = g_string_append_c(string, i+49);	
	list = g_list_append(list, string);
}

gtk_combo_set_popdown_strings(GTK_COMBO(combo), list);
gtk_table_attach_defaults(GTK_TABLE(table1), combo, 2, 3, 2, 3);
gtk_widget_show(combo);
g_list_free(list);


What I want to happen is to put:  Week 1, Week 2, Week 3, etc... in the combo
Box, but when I run it, I get the following errors:

Gtk-CRITICAL **:file gtklabel.c line 187 (gtk_label_new):assertion 'str != NULL' failed.

Gtk-CRITICAL **:file tkmisc.c: line 160 (gtk_misc_set_alignment): assertion 'misc != NULL' failed.

Gtk-CRITICAL **:file gtkcontainer.c: line 687 (gtk_container_add):assersion 'widget != NULL' failed.

Gtk-CRITICAL **:file gtkwidget.c: line 1345 (gtk_widget_show): assertions 'widget != NULL' failed.


Can someone give me a quick example on how to do this?


Thanks.


-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post