Re: Events between Objective C objects
Re: Events between Objective C objects
- Subject: Re: Events between Objective C objects
- From: publiclook <email@hidden>
- Date: Mon, 19 May 2003 17:46:56 -0400
Objective-C's use of inter-object messaging removes the need for event
passing as it is used in most GUI frameworks and other languages.
Interface Builder does nothing special. The "target" outlet (instance
variable) just stores a pointer to an object that will receive
messages. The action instance variable stores the selector for the
message that will be sent to the target. If the target is nil, a
"chain of responsibility" pattern is used to find a receiver for the
message.
The IBAction and IBOutlet macros just provide hints ti Interface
Builder when it parses files. When using the C pre-processor, IBOutlet
evaluates to nothing and IBAction evaluates to the C type void.
Depending on what you are doing, you may want the NSResponder class
which is a base class for all classes that handle user input events
like key presses and mouse movements. You may want
NSNotificationManager which provides a publish and subscribe capability
(one to many messaging). You may want a delegate or target (one to one
with special conventions). You may just want to send plain old
Objective-C messages which are one to one.
All techniques that I have described are synchronous.
On Monday, May 19, 2003, at 03:55 PM, Rolf wrote:
Hi,
I'm searching for a simple straight forward way of implementing events
between non-visual objects coded in Objective C. The event mechanism
must be synchronous, should not involve broadcasting and does not need
to support multiple listeners - one to one connections is ok.
Registering
for event reception (making a "connection" in Objective C
terminology?) and triggering of the event must be done programatically
- i.e no InterfaceBuilder. How's this done in Objective C ?
When making connections in InterfaceBuilder I see that
IBAction/IBOutlet are used but I don't see the actual code that
registers for event and that generates the event. How is this done
programatically ?
/Rolf
_______________________________________________
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.
_______________________________________________
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.