Valeur de retour de gtk_spin_button_new_with_range
Bonjour à tous,
Voilà je suis sur GTK, et je veux utiliser 81 fois gtk_spin_button_new_with_range, dans ma fonction main:
Code:
1 2 3 4 5 6
| for(ligne=1;ligne<=9;ligne++){
for(colonne=1;colonne<=9;colonne++){
pCase[ligne][colonne] = gtk_spin_button_new_with_range(0, 9, 1);
gtk_table_attach_defaults(GTK_TABLE(pTable), pCase[ligne][colonne], colonne, colonne+1, ligne, ligne+1);
}
} |
J'ai donc déclarer en dehors de la fonction main:
Code:
GtkWidget *pCase[10][10];
Je voudrais maintenant enregistrer le contenu de ces cases dans un fichier, j'ai donc fait:
Code:
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
| void OnEnregistrer(){
GtkWidget *selection;
selection = gtk_file_selection_new( g_locale_to_utf8( "Sélectionnez un fichier", -1, NULL, NULL, NULL) );
gtk_window_set_icon_from_file(GTK_WINDOW(selection), "favicon.ico", NULL);
gtk_widget_show(selection);
//On interdit l'utilisation des autres fenetres.
gtk_window_set_modal(GTK_WINDOW(selection), TRUE);
g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(selection)->ok_button), "clicked", G_CALLBACK(recuperer_chemin), selection );
g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(selection)->cancel_button), "clicked", G_CALLBACK(gtk_widget_destroy), selection);
}
void recuperer_chemin (GtkWidget *bouton, GtkWidget *file_selection){
int contenu,ligne, colonne;
const gchar* chemin;
GtkWidget *dialog;
FILE *f;
chemin=gtk_file_selection_get_filename(GTK_FILE_SELECTION (file_selection));
f=fopen(chemin,"w");
for(ligne=1 ;ligne<=9;ligne++){
for(colonne=1;colonne<=9;colonne++){
contenu=gtk_spin_button_get_value_as_int(pCase[ligne][colonne]);
fprintf(f,"%d", contenu);
}
}
gtk_widget_destroy(file_selection);
} |
Si je compile on m'affiche comme erreur:
Code:
1 2
| gtk.c: In function recuperer_chemin:
gtk.c:183: attention : passing argument 1 of gtk_spin_button_get_value_as_int from incompatible pointer type |
Sachant que la ligne 183 correspond à:
Code:
contenu=gtk_spin_button_get_value_as_int(pCase[ligne][colonne]);
Je n'arrive donc pas à comprendre l'erreur puisque j'ai bien défini mes pCases[10][10] à l'exterieur.
Merci d'avance