Re: Newbie - inter object method invocation
Re: Newbie - inter object method invocation
- Subject: Re: Newbie - inter object method invocation
- From: Kyle Mandli <email@hidden>
- Date: Thu, 20 Jun 2002 17:01:05 -0500
Sounds like you may be making it harder than it has to be. The way you
have the code below, you are calling a factory method (class method) but
the method is not written as a factory method (it has a - sign in front
of the method header, a factory method has a +.) This should work if
you import the header file into the App-controller code so that it knows
that the factory method exists.
Another way to do this would be to register with the default
notification center, especially if these will run in separate threads.
This way, whenever App-controller wants the ProcessController to beep it
just has to post the notification to do so. The process controllers
would then only have to register for that notification and call enter
the appropriate selector.
Good luck and feel free to ask more questions if I totally missed your
question or more pop up.
Kyle Mandli
**********************************
Mandli Communications, Inc.
email@hidden
**********************************
>
I'm making this program that tracks a number of different kind of
>
processes.
>
To keep track of and sync everything, I have one App-controller that
>
tracks and controls general stuff and 5 different "process controllers"
>
(one for every kind). And each "process controller" tracks and controls
>
one part of the user interface. Thus:
>
>
GUI
>
|
>
App controller <-> Process controller 1
>
|
>
DATA
>
>
The only problem is that I can't let App controller induce a method of
>
the process controller. I implemented the messaging identical to the
>
currency converter tutorial:
>
Example:
>
- AppController.m file import the ProcessControllers header file
>
>
- ProcessControllers' message I want to be invoked:
>
- (void) beepForMe{
>
NSBeep();
>
}
>
>
- AppControllers' request:
>
[ProcessController beepForMe];
>
>
Then I get the following build warning, and the invocation doesn't take
>
place:
>
>
warning: cannot find class (factory) method.
>
warning: return type for 'beepForMe' defaults to id
>
>
Why doesn't this work? Is it because I have to target an excisting
>
object that has already been instantiated (in contrast to currency
>
converter's converter object? In that case should I use a different way
>
to invoke the method? I know I can probaly use notifications, is this
>
the supposed way of implementing interobject method invocations? Again,
>
all remarks are surely welcome!
>
>
Alex
>
_______________________________________________
>
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.