geting the value of an entry like a float
- From: Murilo Tuvani <murilo_tuvani yahoo com br>
- To: LIST GTK <gtk-app-devel-list gnome org>
- Subject: geting the value of an entry like a float
- Date: Thu, 8 Jul 2004 17:32:49 -0300 (ART)
I'm trying to get the value of an entry and convert it
with atof(), but it allways return 0. The spinbutton
is ok!. Is there a way so I do not net to use
g_locate_to... I just want to use locale char, what do
I do?
float valor_unitario, quantidade, total;
gpointer ponteiro;
ponteiro=gtk_object_get_data(GTK_OBJECT(window_itens),"entry_valor_unitario");
g_print("\nValor unitario %s, (STR)
%10.2f",gtk_entry_get_text(GTK_ENTRY(ponteiro)),
(float)
atof(gtk_entry_get_text(GTK_ENTRY(ponteiro))));
g_print("\nValor unitario %s, (TO)
%10.2f",g_locale_to_utf8(gtk_entry_get_text(GTK_ENTRY(ponteiro)),
-1, NULL, NULL, NULL),
(float)
atof(g_locale_to_utf8(gtk_entry_get_text(GTK_ENTRY(ponteiro)),
-1, NULL, NULL, NULL)));
g_print("\nValor unitario %s, (FROM)
%10.2f",g_locale_from_utf8(gtk_entry_get_text(GTK_ENTRY(ponteiro)),
-1, NULL, NULL, NULL),
(float)
atof(g_locale_from_utf8(gtk_entry_get_text(GTK_ENTRY(ponteiro)),
-1, NULL, NULL, NULL)));
valor_unitario=(float)atof(g_locale_from_utf8(gtk_entry_get_text(GTK_ENTRY(ponteiro)),
-1, NULL, NULL, NULL));
ponteiro=gtk_object_get_data(GTK_OBJECT(window_itens),"spinbutton_qtd");
quantidade=(float)gtk_spin_button_get_value(GTK_SPIN_BUTTON(ponteiro));
total=valor_unitario*quantidade;
g_print("\nUnit\t%10.2f\nQTD\t%10.2f\nTotal\t%10.2f",
valor_unitario, quantidade, total);
_______________________________________________________
Yahoo! Mail agora com 100MB, anti-spam e antivírus grátis!
http://br.info.mail.yahoo.com/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]