handling of GtkEntry?



Hi list, thanks Mihai for the previous suggestion

I write a program which is connected a server. my problem now is the handling of
GtkEntry

 The source is:

//The structure is global

struct register
   {
   char *user, *clav, *srv;
   } host;

//widget for label user and GtkEntry

label=gtk_label_new("User")  
gtk_box_pack_start(GTK_BOX(box),label,TRUE,8,0)
gtk_widget_show(label);
 
login=gtk_entry_new();
gtk_widget_set_usize(login,155,-1);
gtk_signal_connect(GTK_OBJECT(login),"activate",
                  GTK_SIGNAL_FUNC(edit_login), NULL)
   
....

void edit_login(GtkWidget *widget, gpointer data)
{
static char *tmplog;

tmplog=gtk_editable_get_chars(GTK_EDITABLE(widget), 0, -1);
login(tmplog);  //call function login
}
....
int login(const char *tmplog)
{
host.user=g_strdup(tmplog);
}

when press button connect call the function call_host

void call_host(GtkWidget *widget, gpointer data)
{
ServerConnect();
}

int ServerConnect(void)
{
  
             LOGINREC *login_u;      /*this is properly for DB-libraries
   of Sybase
             DBPROCESS *dbproc1;
   
             login_u=dblogin();
             DBSETLUSER(login_u,host.user);  /*value that it has host.user
   ...
   ...
   ...
}

in the function ServerConnect free de memory with g_free(host.user);

My problem is in each one GtkEntry I press enter for store value in memory, if I
not press enter the value not stored, some way to store the value not pressing
enter?

-------------------------------------------------
Obtén tu correo en www.correo.unam.mx
UNAMonos Comunicándonos




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