over-riding the behaviour of the tab key in a NSTextView
over-riding the behaviour of the tab key in a NSTextView
- Subject: over-riding the behaviour of the tab key in a NSTextView
- From: Jake MacMullin <email@hidden>
- Date: Wed, 20 Mar 2002 06:45:53 +1030
Is there a way of temporarily changing the behaviour of a certain key in
a NSTextView without sub-classing it? For example, I have written a
program that auto-completes words. After you type three characters it
guesses the word you want and inserts the remaining characters after the
insertion point and highlights them (so you can keep typing if you don't
want to keep the suggestion). However, most implementations of
auto-completion seem to use the tab key as a way of accepting the
suggestion. In my case, as the suggestion is highlighted, pressing the
tab key just replaces it with a tab.
So what I want to do is say:
if a suggested ending for a word has been made {
if the tab key is pressed { <------- It is these
two lines that I have no idea how to implement
don't insert a tab <-------
move the insertion-point to the end of the suggested word
}
}
Any ideas?
Regards,
Jake MacMullin
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.