• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTableView into edit mode after an insert
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView into edit mode after an insert


  • Subject: Re: NSTableView into edit mode after an insert
  • From: Kevin Hoctor <email@hidden>
  • Date: Thu, 4 May 2006 21:32:46 -0500

I figured out a solution (I guess it took the act of giving up and asking for help). I used the selection changed notification:

- (void)insertObject:(Account *)account inAccountsAtIndex:(int)index
{
// Add the inverse of this operation to the undo stack
NSUndoManager *undo = [self undoManager];
[[undo prepareWithInvocationTarget:self] removeObjectFromAccountsAtIndex:index];
if (![undo isUndoing]) {
[undo setActionName:@"Insert Account"];
}

// Add the Account to the array
isNewAccount = YES;
[self startObservingAccount:account];
[accounts insertObject:account atIndex:index];
}


- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
{
NSIndexSet *indexes = [tableView selectedRowIndexes];

if ([indexes count] == 1) {
int rowSelected = [indexes firstIndex];
...
if (isNewAccount) {
isNewAccount = NO;
[tableView editColumn:0 row:rowSelected withEvent:nil select:YES]; // This works here!
}
} else {
...
}
}


I also added a boolean flag (isNewAccount) so I know when the selection change is because of a new row being added. It seems to be pretty darn bulletproof.

Peace,

Kevin

On May 4, 2006, at 6:55 AM, Kevin Hoctor wrote:

I am thrilled with how easy it has been to implement the population of the NSTableView with an NSMutableArray structure, but I am frustrated that I can't get the first cell to go into edit mode after an insert. Obviously the table is being expanded by the array as shown below and that all works fine:

- (void)insertObject:(Account *)account inAccountsAtIndex:(int)index

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >NSTableView into edit mode after an insert (From: Kevin Hoctor <email@hidden>)

  • Prev by Date: still wrestling with dynamic columns and column auto-resizing
  • Next by Date: rename check? And alias...
  • Previous by thread: Re: NSTableView into edit mode after an insert
  • Next by thread: Animation of window to dock (hotmail is too bad )
  • Index(es):
    • Date
    • Thread