Re: NSBrowser editItemAtIndexPath:withEvent:select:
Re: NSBrowser editItemAtIndexPath:withEvent:select:
- Subject: Re: NSBrowser editItemAtIndexPath:withEvent:select:
- From: Keary Suska <email@hidden>
- Date: Fri, 12 Apr 2013 07:59:42 -0600
On Apr 4, 2013, at 3:13 PM, Paul Wasmund wrote:
> 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.
Have you inspected the index path to make sure it is the expected value? In either case it may not be an issue of "first" column but whether the item is a "branch" or a "leaf". What is the value of allowsBranchSelection ? Does setting it to YES change anything? Additionally, this difference may mean more in the first column than in subsequent columns. Putting a leaf node in the first column and selecting it may reveal something.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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