Re: Struct Problem
- From: Pablo Fischer <exilion yifan net>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Struct Problem
- Date: 02 Nov 2002 17:25:01 -0600
These are the errors the warnings that I get:
prueba_estruct.c: In function `verificar':
prueba_estruct.c:12: warning: passing arg 1 of `gtk_entry_get_text' from
incompatible pointer type
prueba_estruct.c:12: warning: assignment discards qualifiers from
pointer target type
(I export LANG=en_EN to send the warnings, :-)).
Paul Fischer
El sáb, 02-11-2002 a las 16:56, Pablo Fischer escribió:
Hi;
I get it:
text = gtk_entry_get_text((data)->nombre);
g_print("hola%s\n", text);
It runs good.. BUUUUT.. when I compile it... I get 2 warnings:
prueba_estruct.c: En la función `verificar':
prueba_estruct.c:11: aviso: pasando el argumento 1 de
`gtk_entry_get_text' de tipo de apuntador incompatible
prueba_estruct.c:11: aviso: asignación descarta calificadores del tipo
del destino del apuntador
The first warning: means that Im passing the argumen 1 of
gtk_entry_get_text of a incompatible pointer.
The second warning: means that this (the first warning) will cause that
"text" its not going to be used like a pointer
Is it ok?
Thanks
El sáb, 02-11-2002 a las 17:36, Thijs Assies escribió:
Pablo Fischer wrote:
Hi all;
Now Im here.. with a struct problem heh. This is just an example: When I
click the button, it will call a function (validar) that will get the
text and put it into a gchar, I dont know why I cant compile this:
#include <gtk/gtk.h>
typedef struct _Objetos {
GtkWidget *nombre;
GtkWidget *apellido;
} Objetos;
void verificar(GtkWidget *objeto, Objetos *data) {
gchar *text;
text = gtk_entry_get_text(data.nombre);
}
int main(int argc, char *argv[]) {
gtk_init(&argc, &argv);
static Objetos agenda;
GtkWidget *ventana;
GtkWidget *caja_h, *caja_v;
GtkWidget *etiqueta;
GtkWidget *boton;
ventana = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(ventana), "Estructuras");
caja_v = gtk_vbox_new(FALSE, 2);
gtk_container_add(GTK_CONTAINER(ventana), caja_v);
//Nombre:
caja_h = gtk_hbox_new(FALSE, 2);
gtk_box_pack_start(GTK_BOX(caja_v), caja_h, FALSE, TRUE, 2);
etiqueta = gtk_label_new("Nombre: ");
gtk_box_pack_start(GTK_BOX(caja_h), etiqueta, FALSE, TRUE, 2);
agenda.nombre = gtk_entry_new();
gtk_box_pack_start(GTK_BOX(caja_h), agenda.nombre, FALSE, TRUE, 2);
boton = gtk_button_new_with_label("Sirve?");
g_signal_connect(G_OBJECT(boton), "clicked",
G_CALLBACK(verificar), (gpointer) &agenda);
gtk_box_pack_start(GTK_BOX(caja_v), boton, FALSE, TRUE, 2);
gtk_widget_show_all(caja_h);
gtk_widget_show_all(ventana);
gtk_main();
return 0;
}
Paul Fischer
what error do you get?
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]