• 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: Restoring Tiger NSTableView behaviour in Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Restoring Tiger NSTableView behaviour in Leopard


  • Subject: Re: Restoring Tiger NSTableView behaviour in Leopard
  • From: Corbin Dunn <email@hidden>
  • Date: Fri, 11 Apr 2008 14:45:37 -0700


Thank you; that fixed it. Here is my solution (for a 4-column table):

-(void)textDidEndEditing:(NSNotification *)notification
{

	NSInteger editedColumn = [self editedColumn];
	NSInteger editedRow = [self editedRow];

NSDictionary *userInfo = [notification userInfo];
int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue];

if (textMovement == NSTabTextMovement)
{
[super textDidEndEditing:notification];
if (editedColumn == 3)
{
// Select row before calling -(void)editColumn:, and then start editing
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow+1] byExtendingSelection:NO];
[self editColumn:0 row:editedRow+1 withEvent:nil select:YES];
}
}
else if (textMovement == NSBacktabTextMovement)
{
[super textDidEndEditing:notification];
if (editedColumn == 0)
{
// Select row before calling -(void)editColumn:, and then start editing
[self selectRowIndexes:[NSIndexSet indexSetWithIndex:editedRow-1] byExtendingSelection:NO];
[self editColumn:3 row:editedRow-1 withEvent:nil select:YES];
}
}
else
[super textDidEndEditing:notification];

Looks good. You could abstract it using [self numberOfColumns] - 1 instead of 3. Also, add in bounds checks like if editedRow < ([self numberOfRows] - 1) then inc row ... and if editedRow > 0) then dec row.


corbin
_______________________________________________

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


References: 
 >Restoring Tiger NSTableView behaviour in Leopard (From: "K. Darcy Otto" <email@hidden>)
 >Re: Restoring Tiger NSTableView behaviour in Leopard (From: Corbin Dunn <email@hidden>)
 >Re: Restoring Tiger NSTableView behaviour in Leopard (From: "K. Darcy Otto" <email@hidden>)

  • Prev by Date: Re: Restoring Tiger NSTableView behaviour in Leopard
  • Next by Date: Re: enabling drag and drop in nsoutlineview
  • Previous by thread: Re: Restoring Tiger NSTableView behaviour in Leopard
  • Next by thread: enabling drag and drop in nsoutlineview
  • Index(es):
    • Date
    • Thread