NSBrowser editItemAtIndexPath:withEvent:select:
NSBrowser editItemAtIndexPath:withEvent:select:
- Subject: NSBrowser editItemAtIndexPath:withEvent:select:
- From: Paul Wasmund <email@hidden>
- Date: Thu, 04 Apr 2013 16:13:51 -0500
I am trying to use editItemAtIndexPath:withEvent:select: in my program to programatically start editing the text in my cell. It works for all items except those in the first column. As an experiment I added code to the Apple sample ComplexBrowser and the same thing happened. Is this a bug, by design, or are there extra hoops to jump through to get this to work in the first column?
The cells in the first column CAN be edited via clicking in the text of a selected cell.
ComplexBrowser changes:
Add to appController.m
- (void)awakeFromNib {
...
[_browser setAction:@selector(_browserClicked:)]; // add to end of awakeFromNib
}
- (void)_browserClicked:(id)sender
{
FileSystemBrowserCell *cell = [_browser selectedCell];
[cell setEditable:YES];
NSIndexPath *path = [_browser selectionIndexPath];
[_browser editItemAtIndexPath:path withEvent:nil select:YES];
}
- (BOOL)browser:(NSBrowser *)myBrowser shouldEditItem:(id)item
{
return YES;
}
Selecting any cell in the browser should put it into edit mode. Only works for items in columns other than the first one.
Paul
_______________________________________________
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