Re: When is editWithFrame:... used?

Christiaan Hofman <[email protected]> Wed, 7 Dec 2011 01:17:53 +0100
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Dec 7, 2011, at 1:02, John Musbach wrote:

> On Mon, Dec 5, 2011 at 3:00 PM,  <[email protected]> =
wrote:
>> Message: 1
>> Date: Mon, 5 Dec 2011 00:18:35 +0100
>> From: Christiaan Hofman <[email protected]>
>> Subject: When is editWithFrame:... used?
>> To: "[email protected] List" <[email protected]>
>> Message-ID: =
<F256FB34-2237-4E54-820A-E9F9AA20A92C-JAjqph6Yjy+SBuowPCKRtJVzexx5G7lz@public.gmane.org>
>> Content-Type: text/plain;       charset=3Dus-ascii
>>=20
>> Can anyone tell me when NSTextFieldCell's editWithFrame:... method is =
used? In my testing all ways of editing I have tried always go through =
selectWithFrame:... and never use editWithFrame:.... I need to know for =
a subclass whether I need to override this method, but for that I need =
to test it. But when it's not used it's not tested...
>=20
>=20
> editWithFrame:inView:editor:delegate:event:
> Begins editing of the receiver=92s text using the specified field =
editor.
>=20
> - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView
> editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent
> *)theEvent
> Parameters
> aRect
> The bounding rectangle of the cell.
> controlView
> The control that manages the cell.
> textObj
> The field editor to use for editing the cell.
> anObject
> The object to use as a delegate for the field editor (textObj
> parameter). This delegate object receives various NSText delegation
> and notification methods during the course of editing the cell's
> contents.
> theEvent
> The NSLeftMouseDown event that initiated the editing behavior.
> Discussion
> If the receiver isn=92t a text-type NSCell object, no editing is
> performed. Otherwise, the field editor (textObj) is sized to aRect and
> its superview is set to controlView, so it exactly covers the
> receiver. The field editor is then activated and editing begins. It=92s
> the responsibility of the delegate to end editing when responding to
> textShouldEndEditing:. Upon ending the editing session, the delegate
> should remove any data from the field editor.
>=20
> Availability
> Available in Mac OS X v10.0 and later.
> See Also
> =96 endEditing:
> =96 selectWithFrame:inView:editor:delegate:start:length:
> Declared In
> NSCell.h
>=20
>=20
>=20
> --=20
> Best Regards,
>=20
> John Musbach

Yes,  can read the documentation.

And it does not answer my question *when* this is called. It only says =
what it's supposed to do *after* it's called.=20

And what it may suggests, namely that it is called after a mouseDown, is =
not what is actually true in practice. Neither in NSTextField nor in =
NSTableView is it called after a mouseDown.=20

So my question still remiains: when is this ever used?

Christiaan