I forget to reply to all, so here is my reply
---------- Forwarded message ---------- From: Peter Herth herth@peter-herth.de Date: Jan 9, 2006 11:25 PM Subject: Re: [ltk-user] paren-matching entry widgets, and unbinding the TAB key. To: michael graffam mikegraffam@yahoo.com
On 1/9/06, michael graffam mikegraffam@yahoo.com wrote:
Hello all,
I was wondering if someone on this list might be able to help me make a parenthesis matching entry widget?
What I need to know is how (if it is even possible) I can find where the text cursor is in an entry widget. The approach I'd like to use is to bind #) to a function which looks at the current position of the text cursor and iterates backwards through the string looking for the matching #( .. then the icursor position will be set to this location for a second to indicate to the user the matching paren, and then placed back to the original position.
This is really tricky, I just browsed through the Tk docs to the entry widget, and my conclusion is, that it probably is a better idea to use a one-line text widget, this gives you many more options for inquiring the widgets state as well as for the display (like flashing the matching parens in color)
The second question that I have is how I might unbind the TAB key in my entry widget so that hitting TAB will not move focus to the next widget in the window. I'd like TAB to invoke my auto-completion routine (using Control-Space at the moment).
You need to prevent the propagation of the TAB keypress to the widget. One can do this by binding an event so it does not propagate. Do do this I added the :exclusive keyword argument to bind, this will be in the next released version of Ltk.
Peter
-- Dipl.-Phys. Peter Herth