Custom autocompletion with NSTextField
Custom autocompletion with NSTextField
- Subject: Custom autocompletion with NSTextField
- From: Joe White <email@hidden>
- Date: Mon, 01 Aug 2011 00:29:04 +0100
Hi all,
I'm currently implementing custom autocomplete functionality into a
NSTextField. I've managed so far to generate a list of my own available
words and these show when escape is pressed.
However, I'd like the autocompletion to automatically show as the user
types.
I'm using the delegate methods of a NSTextView to override -
(NSArray*)textView:(
NSTextView *)textView completions:(NSArray *)words
forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteger*)index
And setting the delegate in - (void)controlTextDidBeginEditing:(
NSNotification *)obj {
fieldEditor = [[obj userInfo] objectForKey:@"NSFieldEditor"];
[fieldEditor setDelegate:self]; }
Where fieldEditor is a NSTextView declared in the .h file.
The issue is that I was previously using the delegate methods for
NSTextField (controlTextDidChange, controlTextDidEndEditing, etc..) and as
soon as I set the fieldEditor delegate these methods are no longer called.
I'm not really sure what I'm missing here, is there some incompatibility
with setting delegates for a NSTextField and its field editor?
I'm still trying to get my head around interacting with the field editor and
the google results I've read have helped but not answered my problems.
Thanks,
Joe
--
Joe White
Production Department, RjDj
Tel : +44 7515 731499
Reality Jockey Ltd.
Floor B “The Mission”
55 Holywell Lane
London
EC2A 3PQ
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden