Re: When is editWithFrame:... used?

Christiaan Hofman <[email protected]> Thu, 8 Dec 2011 11:24:49 +0100
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Dec 8, 2011, at 3:41, Kyle Sluder wrote:

> On Wed, Dec 7, 2011 at 4:20 PM, Christiaan Hofman <[email protected]> =
wrote:
>> And there's a difference between "show in use" and "subclass it". The =
sample code only does the latter, that does not mean that it is in use, =
and it is never called anywhere in the sample code. The sample code also =
does not say what one should do to have it called, so it most definitely =
does not qualify as "show in use".
>=20
> The NSTableView documentation for -editColumn:row:withEvent:select:
> contains an error; it should say "This method [=85] sends
> editWithFrame:inView:editor:delegate:event: or, if select is YES,
> selectWithFrame:inView:editor:delegate:start:length: to the field
> editor=92s NSCell object with the NSTableView as the text delegate."
>=20
> The only case I've found so far that calls -editWithFrame:=85 is
> NSMatrix. Stick a couple of NSTextFieldCells in an NSMatrix and click
> around, and you'll break on -[NSCell editWithFrame:=85]. You'll also
> probably break on -selectWithFrame:=85 at least once, so I don't know
> what logic NSMatrix is using.
>=20
> NSCell's implementation is actually the same for both -editWithFrame:=85=

> and -selectWithFrame:=85. NSTextFieldCell does not override either of
> these methods, so the behavior is the exact same.
>=20
> I don't know if having two methods is useful anymore, or indeed if it =
ever was.
>=20
> --Kyle Sluder


Thanks, that makes much more sense and seems to agree with reality than =
the actual documentation. I indeed only called editColumn:  with YES for =
select for my test cases. I thought it would not matter for that, based =
on how it works (it both edits the same) and on the documentation. Your =
description also shows it's used very inconsistently. I am sure it makes =
no sense to have both methods. But then most of NSCell's API is a big =
bad legacy mess, which is used very inconsistently across various NSCell =
and NSControl subclasses.=20

Christiaan