Re: Connection of focus_out_event to a GtkEntry



Do folllowing
1. setup callback for focus out of Entry widget
        gtk_signal_connect(GTK_OBJECT(pfp->f_widget), "focus_out_event",
                           GTK_SIGNAL_FUNC(focus_out_entry),(FIELD *)
pfp);  
      (FIELD *) pfp is pointer to a struture where data should be stored 
2.  callback funktion sample
  void focus_out_entry(entry_field,event,fi)
        GtkWidget *entry_field;
        GdkEvent  *event;
        FIELD * fi;
{       POS p;
        int fun_ret = 1;
        char * field_text = gtk_editable_get_chars(entry_field,0,-1);
        GdkEventKey * event_key = &Event_key;
   /* field_text is the contents of the entry widget
      you also can get parts of entry widgets see
gtk_editable_get_chars       */

   /* be careful with recursions we watch if the callback is still
active        
      otherwise you get an infinit loop an the task crash when stack
overflows */

   /* dont forget to free memory */
        g_free(field_text); 
}                                             
Deepu Roy wrote:

Hi,
    I'm trying to store the value of a few GtkEntry widgets in a
structure. Could I add a signal like focus_out_event or
leave_notify_event to the GtkEntry and then connect a callback which
assigns the value to the structure.

Any help is appreciated
Deepu

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
R=I+S  Rapp Informatik Systeme GmbH
       Rosenbühlstr. 24
       D-89182 Bernstadt
       Tel:  +49 (0)7348-7755
       Fax:  +49 (0)7348-6086
E-MAIL  mailto: guenther rapp-informatik de
WEB             www.rapp-informatik.de

Attachment: guenther.vcf
Description: Card for günther



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