Re: Where is the input callback method in glade?
Tristan Van Berkom <[email protected]>
| Newsgroups | gmane.comp.gnome.glade.user |
|---|---|
| Message-ID | <CAGUy9WKm5GMXoNirETYh-s_b=500aCs_q2x4Xqyjdw9119Rq9g@mail.gmail.com> |
On Thu, Oct 6, 2011 at 3:28 AM, Rottengatter, Peter < [email protected]> wrote: > > The infinite loop is easily avoided by setting a flag while modifying the > text withing the handler, and testing the flag at the beginning of the > handler (not exactly a beautiful solution, but I'm sure it works). This way > your intented functionality can be implemented with GtkEntry. > > FWIW, for this recursion check you can use g_signal_handlers_block/unblock_by_func(). Cheers > I have no experience with GtkTextView though. It's not a GtkEditable, hence > the details of how to implement this will be different. > > Regards > > Peter Rottengatter > > -----Original Message----- > From: Ferdinand Ramirez [mailto:[email protected]] > Sent: 06 October 2011 08:18 > To: Rottengatter, Peter; [email protected] > Subject: RE: [Glade-users] Where is the input callback method in glade? > > 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 < > [email protected]> wrote: > > > From: Rottengatter, Peter <[email protected]> > > Subject: RE: [Glade-users] Where is the input callback method in glade? > > To: "Ferdinand Ramirez" <[email protected]>, " > [email protected]" <[email protected]> > > 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: [email protected] > > [mailto:[email protected]] > > On Behalf Of Ferdinand Ramirez > > Sent: 04 October 2011 13:55 > > To: [email protected] > > 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 - [email protected] > > 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 > > > _______________________________________________ > Glade-users maillist - [email protected] > http://lists.ximian.com/mailman/listinfo/glade-users > _______________________________________________ Glade-users maillist - [email protected] http://lists.ximian.com/mailman/listinfo/glade-users