FROM : Constantine
DATE : Tue Jan 29 07:37:40 2008
The following sample may help you:
http://developer.apple.com/samplecode/TextLinks/listing2.html
In file: Controller.m, there are some NSTextView delegate methods such as:
- (BOOL) textView: (NSTextView *) textView
clickedOnLink: (id) link
atIndex: (unsigned) charIndex
To make the given object the receiver’s delegate, you can use Interface
Builder or NSApplication's setDelegate:" method.
Also, NSNotificationCenter's "addObserver:selector:name:object:" can be used
to observe some notifications.
=============================================
Qi Liu
E-Mail: <email_removed>
--Stay Hungry. Stay Foolish.
--You've got to find what you love.
=============================================
----- Original Message -----
From: "Douglas Davidson" <<email_removed>>
To: "Nick Zitzmann" <<email_removed>>
Cc: "王兆明" <<email_removed>>; <<email_removed>>
Sent: Tuesday, January 29, 2008 11:12 AM
Subject: Re: How can I retrieve the control's message?
>
> On Jan 28, 2008, at 6:05 PM, Nick Zitzmann wrote:
>
>> The Mac OS X equivalent is to subclass the view and override the method
>> that handles the event, such as -keyDown:, -mouseDown:, etc.
>>
>> But many classes, such as NSTextField, have either an action or delegate
>> API that gets called when something happens, such as -
>> controlTextDidChange:. If either a target/action or a delegate did-
>> change method is present in the class (or superclass), then you should
>> use them instead unless you really know what you're doing.
>
> I would put the second paragraph here first, for emphasis. If you're
> dealing with anything that handles real text input--NSTextField, for
> example--then you definitely do not want to be overriding -keyDown:. The
> real solution to the OP's question is to start with some tutorials; any
> introductory set of Cocoa examples would answer these sorts of very basic
> questions, for which the answer is usually going to be "hook it up in
> IB".
>
> Douglas Davidson
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
DATE : Tue Jan 29 07:37:40 2008
The following sample may help you:
http://developer.apple.com/samplecode/TextLinks/listing2.html
In file: Controller.m, there are some NSTextView delegate methods such as:
- (BOOL) textView: (NSTextView *) textView
clickedOnLink: (id) link
atIndex: (unsigned) charIndex
To make the given object the receiver’s delegate, you can use Interface
Builder or NSApplication's setDelegate:" method.
Also, NSNotificationCenter's "addObserver:selector:name:object:" can be used
to observe some notifications.
=============================================
Qi Liu
E-Mail: <email_removed>
--Stay Hungry. Stay Foolish.
--You've got to find what you love.
=============================================
----- Original Message -----
From: "Douglas Davidson" <<email_removed>>
To: "Nick Zitzmann" <<email_removed>>
Cc: "王兆明" <<email_removed>>; <<email_removed>>
Sent: Tuesday, January 29, 2008 11:12 AM
Subject: Re: How can I retrieve the control's message?
>
> On Jan 28, 2008, at 6:05 PM, Nick Zitzmann wrote:
>
>> The Mac OS X equivalent is to subclass the view and override the method
>> that handles the event, such as -keyDown:, -mouseDown:, etc.
>>
>> But many classes, such as NSTextField, have either an action or delegate
>> API that gets called when something happens, such as -
>> controlTextDidChange:. If either a target/action or a delegate did-
>> change method is present in the class (or superclass), then you should
>> use them instead unless you really know what you're doing.
>
> I would put the second paragraph here first, for emphasis. If you're
> dealing with anything that handles real text input--NSTextField, for
> example--then you definitely do not want to be overriding -keyDown:. The
> real solution to the OP's question is to start with some tutorials; any
> introductory set of Cocoa examples would answer these sorts of very basic
> questions, for which the answer is usually going to be "hook it up in
> IB".
>
> Douglas Davidson
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
>
| Related mails | Author | Date |
|---|---|---|
| ??? | Jan 29, 02:58 | |
| Nick Zitzmann | Jan 29, 03:05 | |
| John Stiles | Jan 29, 03:06 | |
| Douglas Davidson | Jan 29, 03:12 | |
| Constantine | Jan 29, 07:37 |






Cocoa mail archive

