On Mon, 2002-07-22 at 11:01, Christian Reis wrote: > On Mon, Jul 22, 2002 at 09:54:06AM -0400, Steve McClure wrote: > > > I'm writing a simple editor, and I want that when a user press a > > > tab-key this char is automatically replaced with some spaces. I've > > > tried to added a callback to the "insert-text" signal but using this > > > event I obtain a buffer with some spaces after a tab (instead of > > > one with only spaces). > > > Which signal should i use? > > > > insert-text is what you want, but you need to use the 'length' parameter > > that is passed to the handler. The signal handler signature looks like > > this: > > > > textwidget_insert_text(self, entry, text, len, obj): > > # entry is the text widget > > # text is a buffer of the newly inserted text > > # len is the number of characters in the buffer (it is not null > > # terminated) > > # obj - I don't know what this object is or what it is used for. > > obj can be passed in to the handler when using connect(), but I rarely > use it myself. > > If this is in pygtk-0, Steve, I don't know how to do what you are > suggesting; my example here is the only way I've found to properly block > the original keypresses being inserted into editables. Can you > elaborate; i'd add to the FAQ?
Sorry, I was just explaining that insert-text was indeed the correct signal to use and that Pier had possibly overlooked the length of the buffer was being passed as it was stated in the original question that there were spaces in the buffer passed to the signal handler along with the tab character. You do have to use a technique like you described in your mail about the new FAQ entry. Sorry, I didn't mean to imply that there was any complete solution in my message, just trying to explain what was being seen in the signal handler parameters. > > Take care, > -- > Christian Reis, Senior Engineer, Async Open Source, Brazil. > http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL > _______________________________________________ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Steve McClure 430 10th St NW Racemi Suite N-210 http://www.racemi.com Atlanta, GA 30318 [EMAIL PROTECTED] voice/fax: 404-892-5850
signature.asc
Description: This is a digitally signed message part
