|
楼主 |
发表于 2004-10-22 18:06:39
|
显示全部楼层
GtkWidget *create_window (void)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "wwww");
gtk_signal_connect (GTK_OBJECT (window), "destroy",GTK_SIGNAL_FUNC (my_quit), NULL);
gtk_widget_set_usize (window, 165, 600);
gtk_container_set_border_width (GTK_CONTAINER (window), 2);
vbox = gtk_vbox_new (FALSE, 0);
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 2);
scrolled_win = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
GTK_POLICY_AUTOMATIC, K_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 0);
gtk_widget_set_usize (scrolled_win, 150, 300);
gtk_widget_show (scrolled_win);
tree = gtk_tree_new ();
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), tree);
/* select mode */
gtk_tree_set_selection_mode (GTK_TREE (tree), GTK_SELECTION_SINGLE);
gtk_widget_show (tree);
/* 日历构件 */
frame = gtk_frame_new ("Calendar");
gtk_widget_show (frame);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_set_usize (frame, 165, 130);
gtk_container_set_border_width (GTK_CONTAINER (frame), 2);
calendar = gtk_calendar_new ();
table = gtk_table_new (2, 3, FALSE);
gtk_widget_show (table);
gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
gtk_widget_set_usize (table, 165, 50);
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
gtk_table_set_col_spacings (GTK_TABLE (table), 4);
gtk_container_set_border_width (GTK_CONTAINER (table), 2);
//然后table里面是几个按钮:
button1 = gtk_button_new_with_label ("clicked");
gtk_widget_show (button1);
gtk_table_attach (GTK_TABLE (table), button1, 0, 1, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_usize (button1, 50, 25);
button2 = gtk_button_new_with_label ("clicked");
gtk_widget_show (button1);
gtk_table_attach (GTK_TABLE (table), button2, 1, 2, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_usize (button1, 50, 25);
button3 = gtk_button_new_with_label ("clicked");
gtk_widget_show (button3);
gtk_table_attach (GTK_TABLE (table), button3, 2, 3, 0, 1,
(GtkAttachOptions) (GTK_FILL),
(GtkAttachOptions) (0), 0, 0);
gtk_widget_set_usize (button3, 50, 25);
seek = gtk_adjustment_new (0, 0, 100, 1, 0, 0);
scale = gtk_hscale_new (GTK_ADJUSTMENT (seek));
gtk_object_set_data_full (GTK_OBJECT (window), "scale", scale,
(GtkDestroyNotify) 0);
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
gtk_table_attach(GTK_TABLE(table), scale, 0, 3, 1, 2,
(GtkAttachOptions)(GTK_FILL),
(GtkAttachOptions)(0),0,0);
gtk_widget_show (scale);
gtk_widget_show_all (window);
}
nt main (int argc, char *argv[])
{
gtk_init (&argc, &argv);
create_window ();
gtk_main ();
return 0;
}
没什么保密的。只是嫌麻烦,看了不爽!
我在以前的系统里面能运行的,重装linux就出现这样的问题了!
郁闷,都好几天了!运行就出现上面的问题,调试也是这样!
帮忙分析一下是object错误吗! |
|