"controlTextDidEndEditing:" not called if "Auto Rearrange Content"

I use the delegate method “controlTextDidEndEditing:” in the delegate object for a table that has an array controller. However, if the array controller in IB is set to “Auto Rearrange Content”, and the column is set to sorted, then the method “controlTextDidEndEditing:” will only be called if the content of the cell is NOT changed!

I find that very strange and troublesome, so I wonder if there is way to remedy this? (Except by turning off auto-rearrange and then explicitly call “rearrangeObjects” whenever it might be necessary.)

– a very puzzled Harald

I wonder if the reason that this happens is because there might be some confusion about what was being edited when after the edit, the edited value moves to somewhere else. The notification that gets sent to the controlTextDidEndEditing method includes the frame of the cell that was being edited – this cell will contain something other than what was just edited if the content gets rearranged. In any case, you can do what you said in your post to get around it if you want.

Ric

Ric, you are probably right. But I do really think it is a real bug! It shouldn’t behave the way it obviously does. If it really is technically impossible (or totally infeasible) to keep track of the frame of the cell, then I think that the method “controlTextDidEndEditing:” should be completely disabled (and making that very clear) if “Auto Rearrange Content” is set to On.

But in my case, it is no longer a problem, because I finally came to the conclusion that the auto-rearrange would probably be more confusing/annoying to the user than it is help (especially for large tables). So I chose to instead have a button plus a shortcut to refresh the sorting, and in additon it will refresh the sorting if the user clicks on an empty row (which deselects rows) – it’s less automatic, but less risk of confusion. I think it depends on the particular application if it is regarded as annoing with auto-rearrange On or if it is annoying when there is no auto-rearrange. Possibly, different people may have different reactions towards this.

I would be very annoyed if the Finder did not auto-rearrange (and yes I hate Windows XP for that), whereas it might be confusing with rows suddenly moving around while editing cells in a table. It’s hard to know how users will react.