[Glade-users] Where is the input callback method in glade?

Ferdinand Ramirez ramirez.ferdinand at yahoo.com
Thu Oct 6 02:18:13 EDT 2011


Thanks. I tried something similar with GtkTextBuffer and it worked, but I cannot modify the text, only block it or let it through. If I modify it, and insert the modified text into the buffer from within the callback, I end up in an infinite loop.

Is there another way you know, using GtkTextView perhaps?

Thanks,
-Ferdinand

--- On Wed, 10/5/11, Rottengatter, Peter <Peter.Rottengatter at bakerhughes.com> wrote:

> From: Rottengatter, Peter <Peter.Rottengatter at bakerhughes.com>
> Subject: RE: [Glade-users] Where is the input callback method in glade?
> To: "Ferdinand Ramirez" <ramirez.ferdinand at yahoo.com>, "glade-users at lists.ximian.com" <glade-users at lists.ximian.com>
> Date: Wednesday, October 5, 2011, 12:46 AM
> 
> Read
> http://developer.gnome.org/gtk/stable/GtkEditable.html#GtkEditable-insert-text
> 
> 
> I use the following code to restrict input to numerical
> characters (so that the user can only enter positive integer
> numbers):
> 
> ...
> GtkEntry  *entry = gtk_entry_new();
> gtk_signal_connect (G_OBJECT (entry), "insert-text",
> G_CALLBACK (entry_insert), NULL);
> ...
> 
> void entry_insert (GtkEditable *entry, char *new, gint len,
> gpointer position, gpointer data)
> {
>   gboolean  faulty = FALSE;
>   for (int i = 0; i < len; i++)
>   {
>     if (! isdigit (new[i]))
>       faulty = TRUE;
>   }
>   if (faulty)
>   {
>     g_signal_stop_emission_by_name ((gpointer)
> entry, "insert-text");
>   }
> }
> 
> 
> Regards
> 
> Peter Rottengatter
> 
> -----Original Message-----
> From: glade-users-bounces at lists.ximian.com
> [mailto:glade-users-bounces at lists.ximian.com]
> On Behalf Of Ferdinand Ramirez
> Sent: 04 October 2011 13:55
> To: glade-users at lists.ximian.com
> Subject: [Glade-users] Where is the input callback method
> in glade?
> 
> Where is the callback to keyboard input in glade. I want
> this so that I can respond to each letter that is input.
> 
> As as example, I was looking at the tutorial at http://www.micahcarrick.com/files/gtk-glade-tutorial/C/main.c
> and was wondering how the callback method for keyboard
> inputs can be enabled and how I could modify it.
> 
> For simplicity, let us say that I want to be able to print
> out the characters on the terminal as I input them in the
> above program. I then want to update the buffer instead of
> letting some hidden function in glade do it for me. How do I
> achieve this?
> 
> I'm just using the above example since it is simple and
> neatly written.
> 
> Thanks,
> -Ferdinand
> _______________________________________________
> Glade-users maillist  -  Glade-users at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-users
> Baker Hughes INTEQ GmbH
> Baker-Hughes-Strasse 1, D - 29221 Celle
> Tel.: +49 5141 203 0, Fax: +49 5141 203 296
> Sitz der Gesellschaft: Celle, Amtsgericht Lüneburg HRB
> 100845
> Geschäftsführer: Johannes Witte, Tommie Lee Pate, Dr.
> Hans-Werner Hesse
> 
> Diese Nachricht ist ausschließlich für die Person oder
> Organisation bestimmt, an die sie adressiert ist. Sie kann
> herstellerspezifische, nur für bestimmte Personen
> bestimmte,  vertrauliche oder andere Informationen
> enthalten, die kraft Gesetzes nicht offen gelegt werden
> müssen.  Wenn Sie nicht der in der Adresse genannte
> Empfänger sind oder versehentlich in der Adresszeile
> angesprochen werden, sind Sie nicht berechtigt, diese
> Nachricht oder Teile davon zu lesen, zu drucken,
> aufzubewahren, zu kopieren oder zu verbreiten.  Sollten
> Sie diese Nachricht irrtümlich erhalten haben,
> benachrichtigen Sie bitte den Absender umgehend per Email
> und vernichten Sie sämtliche Kopien der Nachricht.
> 
> DISC-GER-A
> 


More information about the Glade-users mailing list