From: Ricardo Markiewicz Date: Wed, 7 Apr 2004 03:40:19 +0000 (+0000) Subject: * Agrego funciones para castear los tipos de datos los widgets X-Git-Tag: svn_import_r684~617 X-Git-Url: https://git.llucax.com/z.facultad/75.06/emufs.git/commitdiff_plain/f41ad014e7d68321ff67258b99817651ecdab0bb?ds=inline * Agrego funciones para castear los tipos de datos los widgets --- diff --git a/gui/articulos.c b/gui/articulos.c index 28c0cc1..8480a3f 100644 --- a/gui/articulos.c +++ b/gui/articulos.c @@ -119,7 +119,7 @@ t_Articulo *art_form_buscar(WINDOW *win) form = form_crear(win); form_agregar_widget(form, INPUT, "Numero de Artículo", 8, ""); form_ejecutar(form, 1,1); - articulo = art_obtener(NULL, form_obtener_valor(form, "Numero de Artículo")); + articulo = art_obtener(NULL, form_obtener_valor_char(form, "Numero de Artículo")); form_destruir(form); return articulo; diff --git a/gui/form.c b/gui/form.c index 21e7d48..a97e3ba 100644 --- a/gui/form.c +++ b/gui/form.c @@ -121,7 +121,19 @@ void form_ejecutar(t_Form *f, int x, int y) } } -char *form_obtener_valor(t_Form *f, const char *widget) +int form_obtener_valor_int(t_Form *f, const char *widget) +{ + /* TODO : verificar errores */ + return atoi(form_obtener_valor_char(f, widget)); +} + +float form_obtener_valor_float(t_Form *f, const char *widget) +{ + /* TODO : verificar errores */ + return atof(form_obtener_valor_char(f, widget)); +} + +char *form_obtener_valor_char(t_Form *f, const char *widget) { /* Busco el widget */ t_Widget *tmp = f->primero; diff --git a/gui/form.h b/gui/form.h index 8227150..4905196 100644 --- a/gui/form.h +++ b/gui/form.h @@ -97,7 +97,11 @@ void form_ejecutar(t_Form *f, int x, int y); * \param widget Nombre del campo. * \return "" Si no se encontro nada. */ -char *form_obtener_valor(t_Form *f, const char *widget); +char *form_obtener_valor_char(t_Form *f, const char *widget); + +int form_obtener_valor_int(t_Form *f, const char *widget); + +float form_obtener_valor_float(t_Form *f, const char *widget); #endif