Re: any ideas for a fix?



=====
Organization: Thought Unlimited.  Public service Unix since 1986.
Of_Interest: With 28 years  of service  to the  Unix  community.

On Thu, Aug 21, 2014 at 10:44:41PM +0200, Colomban Wendling wrote:
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

        attached is what I had on tuesday the 19th....  it is "l2.c
        and creates a 700 by 900  window and three label strings.
        not quite right...

        cheers!

        gary



-- 
 Gary Kline  kline thought org  http://www.thought.org  Public Service Unix
             Twenty-eight years of service to the Unix community.




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