Re: Problem in GTK+ box?



> The error is:
> (clabel:1197): Gtk-WARNING **: Attempting to add a
> widget with type GtkFrame 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 GtkVBox

That must be the most helpful error message I have ever seen, and tells you
precisely the reason for the error.

It is telling you that your widget (i.e. 'window') "already contains a
widget of type GtkVBox", which is true because you added it with the lines:

> box=gtk_vbox_new(TRUE,0);
> gtk_container_add(GTK_CONTAINER(window),box);

Since "a GtkWindow can only contain one widget at a time", you can't also
add the GtkFrame that you're attempting to with the lines:

> frame1=gtk_frame_new (NULL);
> gtk_container_add (GTK_CONTAINER (window), frame1);

Instead, try adding the frames to the vbox (rather than the window) with a
call to a function such as gtk_box_pack_end().

Regards,
Richard.




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