gtk+ 环境下,遇到assertion 'GTK_IS_NOTEBOOK (notebook)' failed,怎么破?
2015-09-27 22:48
351 查看
Gtk-CRITICAL **: IA__gtk_notebook_remove_page: assertion 'GTK_IS_NOTEBOOK (notebook)' failed #include 2 #include
3 GtkWidget*entry;
4 void notebook_remove(GtkWidget*button,gpointer notebook)
5 {
6 gint page;
7 gchar buffer[20];
8 page=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
9 snprintf(buffer,20,"It is the %dth page",page);
10 gtk_entry_set_text(GTK_ENTRY(entry),buffer);
11 gtk_notebook_remove_page(GTK_NOTEBOOK(notebook),page);
12 }
13 int main(int argc,char**argv)
14 {
15 GtkWidget*window;
16 GtkWidget*tabel;
17 GtkWidget*notebook;
18 GtkWidget*button;
19 GtkWidget*label;
20 gchar bufferl[40];
21 gint i;
22 gtk_init(&argc,&argv);
23 window=gtk_dialog_new();
24 gtk_window_set_default_size(GTK_WINDOW(window),600,200);
25 notebook=gtk_notebook_new();
26 for(i=0;ivbox),notebook,FALSE,FALSE,0);
33 entry=gtk_entry_new();
34 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),entry,FALSE,FALSE,0);
35 gtk_entry_set_text(GTK_ENTRY(entry),"Nothing happens");
36 button=gtk_button_new_with_mnemonic("remove");
37 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area),button,FALSE,FALSE,0);
38 g_signal_connect_swapped(GTK_OBJECT(button),"clicked",G_CALLBACK(notebook_remove),notebook);
39 button=gtk_button_new_with_label("close app");
40 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->action_area),button,FALSE,FALSE,0);
41 g_signal_connect(GTK_OBJECT(button),"clicked",G_CALLBACK(gtk_main_quit),NULL);
42 gtk_widget_show_all(window);
43 gtk_main();
44 return 0;
45 }
46
相关文章推荐
- 欧拉工程第74题:Digit factorial chains
- obtainKeywords
- 2015 ACM/ICPC Asia Regional Shanghai Online
- leetcode11 Container With Most Water
- Kafka错误1_kafka中 FailedToSendMessageException解决_修改host.name
- A child container failed during start
- Contains Duplicate III
- vs2010编译没有问题,然而运行出错Run-Time Check Failure #2 - Stack around the variable 'a' was corrupted.
- MainPage.xaml
- 使用SDL2出现 “error LNK2019: 无法解析的外部符号 _SDL_main,该符号在函数 _main 中被引用” 时的可能错误记录
- Hdu1163 Eddy's digitai Roots(九余数定理)
- 真机测试INSTALL_FAILED_INSUFFICIENT_STORAGE解决办法
- 如何重装air
- main函数的参数:处理命令行选项
- 2015 ACM/ICPC Asia Regional Shanghai Online 1008
- Handling Complexity in the Halo 2 AI
- Contains Duplicate III
- Training ------- Getting Started
- mybaits标签
- SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".