GtkCombo bugs?



Combo Box doesn't seem to work right .. or am I doing something wrong?
If I first select "2" in this test program and then push button, the list
becomes empty.. I'm using the latest GTK from CVS.

#include <gtk/gtk.h>

GList *tmp;

void add(GtkWidget *widget, GtkCombo *combo)
{
    gtk_combo_set_popdown_strings(combo, tmp);
}

int main (int argc, char *argv[])
{
    GtkWidget *win, *combo, *box, *but;

    gtk_init (&argc, &argv);

    tmp = g_list_append(NULL, "1");
    tmp = g_list_append(tmp, "2");

    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    box = gtk_vbox_new(FALSE, 0);
    gtk_container_add(GTK_CONTAINER(win), box);
    gtk_widget_show(box);

    combo = gtk_combo_new();
    gtk_box_pack_start(GTK_BOX(box), combo, TRUE, TRUE, 0);
    add(NULL, GTK_COMBO(combo));
    gtk_widget_show(combo);

    but = gtk_button_new_with_label("push");
    gtk_signal_connect (GTK_OBJECT (but), "clicked",
                        GTK_SIGNAL_FUNC(add), combo);
    gtk_box_pack_start(GTK_BOX(box), but, TRUE, TRUE, 0);
    gtk_widget_show(but);

    gtk_widget_show(win);

    gtk_main ();

    return 0;
}



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