Re: NSTextView question
Re: NSTextView question
- Subject: Re: NSTextView question
- From: Simon Jacquier <email@hidden>
- Date: Sun, 14 Apr 2002 14:02:11 +0200
email@hidden <email@hidden> wrote:
>
i'm a newbie to cocoa and i'd like to know how to tell an NSTextField to send
>
an action when the tabulation key is pressed. can u help me ?
You mean "to tell a _NSTextView_", right?
Make MyDocument the delegate for your TextView in Interface Builder
(double-click on your TextView, then control-click from the TextView to the
File's Owner to create a link, select the Delegate Outlet in the Inspector
and click Connect), and then add this method to MyDocument.m:
// circumvent the Tab key in the textView
- (BOOL)textView:(NSTextView *)myTextView doCommandBySelector:(SEL)command;
{
if (command == @selector(insertTab:))
{
// do someting here
return YES;
}
return NO;
}
Simon Jacquier
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.