On 08/04/2010, at 11:46 AM, Chris Idou wrote: > > > I've got some code that uses editColumn:0 to force the user into edit mode on > the first column. > > But I've noticed that if user column reordering is allowed, this no longer > edits the correct column. This seems odd to me because I thought Cocoa pretty > much shielded the programmer from all the user reordering stuff. > > Even more oddly, if the user puts a checkbox as the first column, the > checkbox seems to start behaving like a text box, albeit with invisible > characters. Could I be doing something wrong, or is this some kind of bug? > And do I have to somehow translate column 0 to find out the real column? I > know Java tables have methods to translate between model and view column > numbers because of user reordering, but I haven't noticed such a thing in > Cocoa.
Yes, you're doing something wrong. You are assuming that column 0 is always a specific column, which because of user reordering, is not the case. Instead of hard-coding 0 as the index of the column, look up its index by [NSTableView columnWithIdentifier:@"foo"]; The identifier is what identifies the column, not its index, so you have to look up the index dynamically. --Graham _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
