Gtk Entry problem



Hello,

 

I have some problem in getting the data from the GtkEntry widget.

 

Let me explain it with code.

I have used the Glade functions to hook up the object reference as follows

 

GLADE_HOOKUP_OBJECT_NO_REF(window, window, “main_window”);

GLADE_HOOKUP_OBJECT(window, entry, “entry_ref”);

 

And in another part of the code I am using it like this

 

gchar *Func (GtkWidget *button, gpointer data)

{

GtkEntry Entry;

G_CONST_RETURN gchar *entry_value;

 

            Entry = lookup_widget(GTK_WIDGET(gtk_widget_get_toplevel(button)), “entry_ref”);

           

            If (Entry != NULL)

            {

                        entry_value = gtk_entry_get_text(GTK_ENTRY(Entry));

                        if (entry_value != NULL)

                        {

                                    g_print(“The value got from the entry is : <%s>\n”);

                                    return entry_value;

                        }

            }

            return NULL;

}

 

This is always printing, “The value got from the entry is :<entry_ref>” and not the actual data.

I don’t know what is happening here, am I making a mistake.

Please help..

 

Regards,

Binoj

 

 

 



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