views:

34

answers:

1

Hello, I'm making an application for someone, and I need to make this NSTextView in an NSScrollView uneditable. Whatever I do, I just can't get anything to work. There is no editable or allow editing check box in Interface Builder for it, so I'll to do it programmatically. So far, I have tried the follow codes.

[TextView setEditable:NO];
[TextView setEditable:FALSE];
[TextView.editable = NO];
[TextView.editable = FALSE];
[TextView editingNotAllowed];

and I just can't get anything to work. If somebody could please help, that would be well appreciated! Also, I'm doing this under:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
}

Thanks for any help at all!

A: 

Have you looked at delegate methods to NSTextView? (specifically NSTextDelegate)

If you implement textShouldBeginEditing: and return NO, it shouldn't edit.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/NSTextDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/NSTextDelegate/textShouldBeginEditing:

phooze
No, it still doesn't work... =(
Daniel Ricany
Where is your TextView instantiated? Can you confirm if the delegate method is even being called?
phooze