Problem in GTK+ box?
- From: =?big5?q?Kevin=20H=20S=20Cheang?= <win_ppt yahoo com>
- To: GTK <gtk-list gnome org>
- Cc: d991615 umac mo
- Subject: Problem in GTK+ box?
- Date: Wed, 19 Mar 2003 21:42:57 +0800 (CST)
Dear All,
I have type the following, but error occurs. What is
the reason?
/* cLabel.c*/
#include <gtk/gtk.h>
int main ( int argc,
char *argv[] )
{
GtkWidget *window;
GtkWidget *frame1;
GtkWidget *frame2;
GtkWidget *box;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "EDA");
g_signal_connect (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_main_quit), NULL);
gtk_widget_set_size_request (window, 300, 300);
gtk_container_set_border_width (GTK_CONTAINER
(window), 10);
box=gtk_vbox_new(TRUE,0);
gtk_container_add(GTK_CONTAINER(window),box);
frame1=gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (window), frame1);
gtk_frame_set_label (GTK_FRAME (frame1), "GTK Frame
Widget");
gtk_frame_set_label_align (GTK_FRAME (frame1), 1.0,
0.0);
gtk_frame_set_shadow_type (GTK_FRAME (frame1),
GTK_SHADOW_ETCHED_OUT);
gtk_box_pack_start(GTK_BOX(box), frame1, FALSE, FALSE,
0);
frame2=gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (window), frame2);
gtk_frame_set_label (GTK_FRAME (frame2), "GTK Frame
Widget");
gtk_frame_set_label_align (GTK_FRAME (frame2), 1.0,
0.0);
gtk_frame_set_shadow_type (GTK_FRAME (frame2),
GTK_SHADOW_ETCHED_OUT);
gtk_box_pack_start(GTK_BOX(box), frame2, FALSE, FALSE,
0);
gtk_widget_show (frame1);
gtk_widget_show (frame2);
gtk_widget_show (box);
gtk_widget_show (window);
gtk_main ();
return FALSE;
}
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
[root localhost clabel]# gedit clabel.c
_________________________________________________________
Do You Yahoo!?
登記免費的 @yahoo.com 中文電子郵件 @ http://chinese.mail.yahoo.com
Get your free @yahoo.com address at http://chinese.mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]