• 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: NSOutlineView edit row problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView edit row problem


  • Subject: Re: NSOutlineView edit row problem
  • From: Fredrik Olsson <email@hidden>
  • Date: Thu, 13 Jul 2006 09:05:39 +0200

David Chan skrev:
Hi all,

I understand that the normal behavior of nsoutlineview or nstableview
is that when you edit a row and you press return key, it would move to
the next row and set that new row into edit state. How can I intercept
this process so that upon user pressing return key, the view will not
highlight the next row? I want the view to just commit the editing and
select the same row in a non-edit state.

Thank you in advance.

This little category solved my problem:

@implementation NSOutlineView (EnterEndsEditing)
- (void)textDidEndEditing:(NSNotification*)notification
{
   if ([[[notification userInfo] objectForKey:@"NSTextMovement"]
intValue] == NSReturnTextMovement) {
       NSMutableDictionary *newUserInfo = [NSMutableDictionary
dictionaryWithDictionary:[notification userInfo]];
       [newUserInfo setObject:[NSNumber
numberWithInt:NSIllegalTextMovement] forKey:@"NSTextMovement"];
       NSNotification *newNotification = [NSNotification
notificationWithName:[notification name]
               object:[notification object] userInfo:newUserInfo];
       [super textDidEndEditing:newNotification];
       [[self window] makeFirstResponder:self];
   } else {
       [super textDidEndEditing:notification];
   }
}
@end

// Fredrik Olsson
Regards
David
_______________________________________________
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


_______________________________________________
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: 
 >NSOutlineView edit row problem (From: "David Chan" <email@hidden>)

  • Prev by Date: NSOutlineView edit row problem
  • Next by Date: Re: Showing table scrollbars
  • Previous by thread: NSOutlineView edit row problem
  • Next by thread: Rotating images and scaling the results: some files pixelate
  • Index(es):
    • Date
    • Thread