Re: looking for ways to monitor text entered into a textfield
Re: looking for ways to monitor text entered into a textfield
- Subject: Re: looking for ways to monitor text entered into a textfield
- From: Nicko van Someren <email@hidden>
- Date: Thu, 10 Nov 2005 12:46:00 +0000
On 10 Nov 2005, at 04:47, Mark Aufflick wrote:
I am playing with an idea for a new style of outliner type program.
One of the things I want to do is interpret tags and links as they
are entered into the text much like a wiki.
...
I have looked at subclassing the container holding the text view
and monitoring all events to track the key events. Anything that
introduced or deleted a ] character would trigger a search for it's
matching [. This approach has lots of limitations to work around
and I am really hoping that there is some smart feature of a cocoa
text class that will notify me when an edit causes a pattern to be
matched.
If anyone has any great ideas about how to accomplish something
along these lines in Cocoa I would really appreciate it!
What you are trying to do seems pretty analogous to the problem of
syntax colouring some source, you just want to set a link attribute
in your attributed text rather than a colour attribute. As such I
suggest you take a look at the variety of projects for supporting
syntax colouring in an NSTextView. There is a thread on CocoaDev.com
[1] about this and Uli has published some hand code [2] for doing
this too. Take a look, pick them apart, learn from them and then it
will all be easy :-)
Nicko
[1] http://www.cocoadev.com/index.pl?ImplementSyntaxHighlighting
[2] http://www.zathras.de/programming/sourcecode.htm
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden