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

I still only get this::

For-Loop():  main with tt = (0)
For-Loop():  main with tt = (1)

(leftJ:22024): Gtk-WARNING **: Attempting to add a widget with
type GtkBox to a GtkWindow, but as a GtkBin subclass a GtkWindow
can only contain one widget at a time; it already contains a
widget of type GtkBox
For-Loop():  main with tt = (2)

(leftJ:22024): Gtk-WARNING **: Attempting to add a widget with
type GtkBox to a GtkWindow, but as a GtkBin subclass a GtkWindow
can only contain one widget at a time; it already contains a
widget of type GtkBox
pts/101 17:17 <tao> [5481]                               



Dunno... .



On Thu, Aug 21, 2014 at 01:41:46PM -0700, Phil Wolff wrote:
> You're trying to use each label in three places, and you can't do that.
> Try this:
> 
> int
> main (int argc, char *argv[])
> {
> 
>   GtkWidget *window, *vbox;   // Labels go in here, vertically orientated.
>   //GtkWidget *label1, *label2, *label3;
>   GtkWidget *label1[32], *label2[32], *label3[32];
>   int tt = 0;
> 
>   gtk_init (&argc, &argv);
> 
>   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
>   gtk_window_set_default_size (GTK_WINDOW (window), 700, 900);
>   gtk_window_set_title (GTK_WINDOW (window), "Labels Left-Margins");
>   gtk_container_set_border_width (GTK_CONTAINER (window), 10);
>   g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
> 
>   for (tt = 0; tt < 3; tt++)
>     {
>       printf ("For-Loop():  main with tt = (%d)\n", tt);
>       label1[tt] = gtk_label_new ("1: This is the file name named 
> talk.1.txt");
>       gtk_misc_set_alignment (GTK_MISC (label1[tt]), 0, 0.5); // left
>       label2[tt] = gtk_label_new ("2: This is talk.2.txt");
>       gtk_misc_set_alignment (GTK_MISC (label2[tt]), 0, 0.5); // left
>       label3[tt] =
>       gtk_label_new ("3: File talk.3.txt file.");
>       gtk_misc_set_alignment (GTK_MISC (label3[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), label1[tt], FALSE, TRUE, 0);
>       gtk_widget_show (label1[tt]);
>       gtk_box_pack_start(GTK_BOX(vbox), label2[tt], FALSE, TRUE, 0);
>       gtk_widget_show (label2[tt]);
>       gtk_box_pack_start(GTK_BOX(vbox), label3[tt], FALSE, TRUE, 0);
>       gtk_widget_show (label3[tt]);
>       gtk_widget_show_all (window);
>       gtk_widget_show_all (window);
>     }
> 
>   gtk_main ();
> 
>   return 0;
> }
> 
> On 08/21/2014 01:30 PM, Gary Kline wrote:
> 
> >=====
> >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 01:01:24PM +0200, Marcus Karlsson wrote:
> >>On Tue, Aug 19, 2014 at 06:43:22PM -0700, Gary Kline wrote:
> >>>=====
> >>>Organization: Thought Unlimited.  Public service Unix since 1986.
> >>>Of_Interest: With 28 years  of service  to the  Unix  community.
> >>>
> >>>guys,
> >>>
> >>>last time I encloused this "leftJ*" code,  it output a 700 by 900
> >>>label with label1, label2, label3.  in "labelWidgets.h" I've got
> >>>a *label[32], and use a global tt=0 that is inc in a for loop.
> >>>the gcc line builds ./leftJ after you unshar or simply run sh against
> >>>the sharball.
> >>>
> >>>it doesn't segv or anything; but it only printfs the last line.  WITH
> >>>complaiints.  can any body help me here?
> >>>
> >>>tia,
> >>>
> >>>gary
> >>>
> >>>Attached: leftJustify.shar
> >>Looks like your attachment didn't make it. Can you post the code sample
> >>online, or include the problematic part inline?
> >>
> >>            Marcus
> >
> >     hi marcus,
> >
> >     don't know what happened to the SHAR file.  BUT: below is the
> >     entire program--minus the labelWidgets.h header.  the header file
> >     just had the int tt.
> >
> >     as-is, this printfs the 700 by 900 window and the third label.
> >     last night, localtime here in seattle, I send mail to two
> >     chaps named chris, moller and vine.  My *main* problem is that
> >     I don't know how to add multiple labels to a single vbox.
> >
> >     Clue me in and givve me a place to stand, and I'll be able to
> >     move the globe!
> >
> >     gary
> >
> >     
> >
> >#include <stdio.h>
> >#include <gtk/gtk.h>
> >// no-more :: #include "labelWidgets.h"
> >
> >/***
> >
> >gcc -Wall -g leftJ.c -o leftJ `pkg-config --cflags gtk+-3.0` `pkg-config 
> >--libs gtk+-3.0`
> >
> >***/
> >
> >int
> >main (int argc, char *argv[])
> >{
> >
> >   GtkWidget *window, *vbox; // Labels go in here, vertically orientated.
> >   //GtkWidget *label1, *label2, *label3;
> >   GtkWidget *label[32];
> >   int tt = 0;
> >
> >   gtk_init (&argc, &argv);
> >
> >   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> >   gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
> >   gtk_window_set_default_size (GTK_WINDOW (window), 700, 900);
> >   gtk_window_set_title (GTK_WINDOW (window), "Labels Left-Margins");
> >   gtk_container_set_border_width (GTK_CONTAINER (window), 10);
> >   g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
> >
> >   for (tt = 0; tt < 3; tt++)
> >     {
> >       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.");
> >       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]);
> >       gtk_widget_show_all (window);
> >     }
> >
> >   gtk_main ();
> >
> >   return 0;
> >}
> 
> -- 
> If sunbeams were weapons of war, we would have had solar energy
> centuries ago.
>     -- George Porter
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

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


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to