J'ai un peu relu et bien lu les fonctions sur http://library.gnome.org/ et selon moi cela devrait être comme ça:
Tout compile sans aucune erreur ou avertissement. J'ai un peu refait le code, et là j'essaie d'insérer la box verticale dans une box horizontale, mais j'ai cette erreur dans un terminal en lancant le prog:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 /* Create horizontal box to be able to insert the GtkBuilder */ GtkWidget *pMainHorizontalBox; pMainHorizontalBox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pMainWindow), pMainHorizontalBox); /* Elements */ GError* GtkBuildError = NULL; GtkBuilder* pBuildMainWindow; pBuildMainWindow = gtk_builder_new(); if(pBuildMainWindow) { if(!gtk_builder_add_from_file(pBuildMainWindow, "MainWindowUI.xml", &GtkBuildError)) { if(GtkBuildError) { printf("Error: %s", GtkBuildError -> message); } } GObject *pMainVerticalBox; pMainVerticalBox = gtk_builder_get_object(pBuildMainWindow, "vbox1"); gtk_box_pack_start_defaults(GTK_BOX(pMainHorizontalBox), GTK_WIDGET(pMainVerticalBox)); } /* Show main window */ gtk_widget_show_all(pMainWindow);
Gtk-CRITICAL **: gtk_box_pack_start: assertion `GTK_IS_WIDGET (child) ` failed
Partager