Bonjour,

Alors j'ai une erreur lors de la compilation un problème de format, cast, d'après ce que je pense avoir compris:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
(c:30704): GLib-GObject-WARNING **: invalid cast from `GtkButton' to `GtkEntry'
 
(c:30704): Gtk-CRITICAL **: gtk_entry_get_text: assertion `GTK_IS_ENTRY (entry)' failed
Mais je ne vois pas comment "caster" si c'est ce qu'il faut faire...

Mon code:
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
#include <stdlib.h>
#include <gtk/gtk.h>
 
void Recup(GtkWidget *, gpointer data);
int main(int argc,char **argv)
{
    GtkWidget *pWindow;
    GtkWidget *box;
    GtkWidget *pLabel;
    GtkWidget *pValider;
    GtkWidget *pInput;
 
 
    gtk_init(&argc,&argv);
 
    pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(pWindow), "Les labels");
    gtk_window_set_default_size(GTK_WINDOW(pWindow), 320, 200);
 
    /* Création de la GtkBox verticale */
     box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
 
     pValider = gtk_button_new_with_label("Valider");
     pLabel = gtk_label_new("Programme de création de paquets");
     pInput =  gtk_entry_new();
 
     gtk_box_pack_start(GTK_BOX(box), pLabel, FALSE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(box), pInput, FALSE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(box), pValider, TRUE, FALSE, 0);
 
     /* Ajout de la GtkVBox dans la fenetre */
    gtk_container_add(GTK_CONTAINER(pWindow), box);
 
 
    g_signal_connect(G_OBJECT(pValider), "clicked", G_CALLBACK(Recup), (GtkWidget*) box);
 
 
    /* Affichage de la fenêtré et de tout ce qu'il contient */
    gtk_widget_show_all(pWindow);
 
    /* Connexion du signal
    /* On appelle directement la fonction de sortie de boucle */
    g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);
 
    gtk_main();
 
    return EXIT_SUCCESS;
}
void Recup(GtkWidget *pInput, gpointer data)
{
   const gchar *sText;
   /* Recuperation du texte contenu dans le GtkEntry */
     sText = gtk_entry_get_text(GTK_ENTRY(pInput));
 
 // printf("\n%s\n",sText);
 
}
Merci