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?

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/

Reply via email to