Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > I need help with NSTableView behavior

I need help with NSTableView behavior
Thread Tools
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Online
Reply With Quote
Mar 4, 2003, 11:26 PM
 
ok, my objective seems simple: on return, I want my table to end editing but not change the selection, or begin editing another cell. Sounds like there should be a delegate method for that, but I haven't found it. So then I thought I can subclass NSTableView. But when I try that (and to put it in a NSScrollView, because without that it's useless), I get "*** -[NSTableView documentView]: selector not recognized" and a crash with SIGTRAP

so wtf? how do I subclass NSTableView and give it the standard behavior (I can't fiddle with something that doesn't work to start with)? Someone please help me see the obvious

I also tried putting a normal NSTableView in a subclass of NSWindow, but the window did not intercept the keystrokes when a table cell was highlighted. sigh...
     
Junior Member
Join Date: Oct 2001
Status: Offline
Reply With Quote
Mar 5, 2003, 04:40 PM
 
you have to overload
Code:
-(void) textDidEndEditing: (NSNotification*) not
select the current cell and end editing.

type R
I be that insane n***a from the psycho ward.
     
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Online
Reply With Quote
Mar 5, 2003, 07:08 PM
 
thanks for the help

but simply adding that method to my table's delegate/data-source does not work (the method is never called). If you mean that I have to subclass NSTableView and then override the method, then I need help subclassing NSTableView in a way that duplicates the default behavior, scrollbars and all.
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Mar 5, 2003, 07:45 PM
 
I believe the method Type R meant was
Code:
- (void)controlTextDidEndEditing:(NSNotification *)aNotification
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Addicted to MacNN
Join Date: Nov 2002
Location: Seattle, WA
Status: Online
Reply With Quote
Mar 6, 2003, 10:59 PM
 
ok, I added that method to my delegat/data-source, and it is called, but doing so doesn't change the behavior. I've experimented with trying to cancel the default behavior (on selectionDidChange, I change it back to where it was before the last data change), but that is inadequate, because for example if the user clicks out of a selected cell, the selection jumps back to where s/he didn't want it. What I have to do is prevent the selection from changing in the first place (on Enter). anyone know how to do that? Is there a way to intercept keystrokes to an NSTableView (or it's scrollView or contentView) without subclassing, or if so, can someone point me to how to subclass successfully? thanks again for the input
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:51 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2