how to read from gtk_entry



Hello,

I created som gtk_entry-fields. I want to read the contents so I can do
someting with the info. But I can't get it right!

I did something like this:

GtkWidget *entry;
char *string;

entry = gtk_entry_new();
gtk_entry_set_text (GTK_ENTRY (entry), " 23.22");

string = gtk_editable_get_char (entry);

But this does not work, I don't read anyting. First question: What goes
wrong?

Second question, is there an event (like a key-event pressed) when the
contents is changed by the user or must I use an alternative way of
checking the contents (with a timer like :
gtk_timeout_add( 1000, Function, NULL); ?)

Third question, I don't have much experience in C, more Matlab. There
you have the function 'str2num' which converts a string, for example
"123.23" into a number or better float in C= 123.23. Is this simpel to
do in the gtk-toolkit or standard C. This is because the contents of the
entry should be a float, so I want to be able to check this to prevent
errors.

Thank you in advance, 
Edward



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]