Re: Getting rid of the field editor after editing [SOLVED]
Re: Getting rid of the field editor after editing [SOLVED]
- Subject: Re: Getting rid of the field editor after editing [SOLVED]
- From: Graham Cox <email@hidden>
- Date: Sat, 26 Jun 2010 22:00:08 +1000
The final piece of the problem was that the hosting custom view was directly calling -resetCursorRects, in violation of the documentation. Once I changed this to the recommended -invalidateCursorRectsForView:, everything was hunky-dory.
--Graham
On 26/06/2010, at 8:46 PM, Graham Cox wrote:
>
> On 26/06/2010, at 6:16 PM, Ken Thomases wrote:
>
>> On Jun 26, 2010, at 2:27 AM, Graham Cox wrote:
>>
>>> What is the correct way to tear down or remove the field editor when editing is complete?
>>
>> The field editor is intimately connected to the window, so it's often the window's responsibility to manage it. See the discussion of the -[NSWindow endEditingFor:] method.
>
>
> Thanks Ken.
>
> I did investigate using that method with no result for a while, but I think I found (most) of the problem.
>
> Seems there are two ways to ask a cell to start editing: -selectWithFrame:... and -editWithFrame:... The custom view (which I didn't originally write but found on the 'net - however there's almost nothing left of the original code having gradually bent it to my will) was calling BOTH of these methods. This results in TWO views getting inserted into the view stack, one exactly on top of the other. On -endEditing:, only one was correctly getting removed. The other became orphaned and continued to draw its background and set the cursor.
>
> Having set it now so that only one of these methods is called, the tear-down is now nearly there, just leaving a cursor rect remaining which gets cleared on a selection change. I'm now looking into fixing that.
>
> So for the record, if you're programming a view that uses a cell, don't call both editing methods - just use one or the other.
_______________________________________________
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