Re: Char = GtkWidget *entry_host



On Sat, Oct 08, 2005 at 01:18:22PM -0300, Wilton wrote:
> 
>  entry_host = gtk_entry_new ();
>  gtk_entry_set_max_length(GTK_ENTRY (entry_host),50);
>  gtk_entry_set_text(GTK_ENTRY (entry_host),"localhost");
>  gtk_box_pack_start(GTK_BOX (vbox), entry_host, TRUE, TRUE, 0);
>  gtk_widget_show(entry_host);
> 
> Now I want to use the value entered in this field in another global 
> variable like this:
> 
> char        host[256];
> 
> But the types are incompatible. How can I solve this problem?

You have to connect to "changed" signal of the entry and
update host whenever the entry changes.  I do not see any
incompatibility between the const gchar* return value of
gtk_entry_get_text() and a char[256] variable -- you can
normally use g_strlcpy() (for example).

Yeti


--
That's enough.



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