Le 21/08/2014 22:30, Gary Kline a écrit : > [...] > { > printf ("For-Loop(): main with tt = (%d)\n", tt); > label[tt] = gtk_label_new ("1: This is the file name named talk.1.txt"); > gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5); // left > label[tt] = gtk_label_new ("2: This is talk.2.txt"); > gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5); // left > label[tt] = gtk_label_new ("3: File talk.3.txt file.");
You assign to the same array index three times (label[tt] = /*...*/; label[tt] = /*...*/; label[tt] = /*...*/) > gtk_misc_set_alignment (GTK_MISC (label[tt]), 0, 0.5); // left > > vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5); // GTK3 > gtk_container_add (GTK_CONTAINER (window), vbox); > gtk_box_pack_start (GTK_BOX (vbox), label[tt], FALSE, TRUE, 0); > gtk_widget_show (label[tt]); > gtk_box_pack_start(GTK_BOX(vbox), label[tt], FALSE, TRUE, 0); > gtk_widget_show (label[tt]); > gtk_box_pack_start(GTK_BOX(vbox), label[tt], FALSE, TRUE, 0); > gtk_widget_show (label[tt]); ...and pack the same widget (label[tt]) three times. GTK widgets can only have one parent, adding them several times is incorrect. You need to pack the first widget before setting the label[tt] to the new one. Or more likely, you need to remove the loop and use 3 different variables (or indexes), the loop seems to be misused. A loop runs the *same* body several times, it doesn't magically make different assignations to the same index work like if they were different ones. Regards, Colomban _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list