Re: Customising the behaviour of an NSTextFieldCell in an NSTableView
Re: Customising the behaviour of an NSTextFieldCell in an NSTableView
- Subject: Re: Customising the behaviour of an NSTextFieldCell in an NSTableView
- From: Douglas Davidson <email@hidden>
- Date: Thu, 6 Jan 2005 15:46:00 -0800
On Jan 6, 2005, at 3:30 PM, Jake Macmullin wrote:
I'd like to customise the behaviour of an NSTextFieldCell that I'm
using in an NSTableView. Basically, I want to do two things:
1). provide my own set of suggestions when complete: is called
2). call complete: after each key-stroke in the cell
I've had limited success so far. To achieve #1 I understand that I
need to provide a delegate for the NSTextField contained by the
NSTextFieldCell - my only problem is, I don't know how to get a
reference to this NSTextField in order to call its setDelegate method.
I've read through the list archives, consulted the API docs, and of
course referred my questions to Google, but there seems to be some
conflicting information. The API docs for NSTextFieldCell describe a
method:
No, you're not being sufficiently general. You need to provide a
delegate for the control that contains the cell, not necessarily a text
field. If the cell is being displayed by a table view, then you want
to set a delegate for the table view that implements
control:textView:completions:forPartialWordRange:indexOfSelectedItem:
(cf. NSControl.h). You also need to read up on the distinction between
NSTextField and NSTextView, and on what the field editor is and does;
you seem to be a bit confused about this.
As for completing on each keystroke, I think you're on the right track;
what you need to do is to be able to distinguish complete:'s changes
from the user's changes, and not fire the completion as a result of the
former. I gave an example of this at the last WWDC, in which the two
sets of changes didn't overlap, although I may not have emphasized that
in my presentation. You may need to set a flag when you are calling
complete:.
Douglas Davidson
_______________________________________________
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