RE: Newbie - inter object method invocation
RE: Newbie - inter object method invocation
- Subject: RE: Newbie - inter object method invocation
- From: <email@hidden>
- Date: Fri, 21 Jun 2002 00:34:01 +0200
- Thread-topic: Newbie - inter object method invocation
Sorry for being so stupid, but no, I didn't make it a subclass of NSApp,
consider the plan to be as follows:
Take the Currency Converter App as it is finished. Consider the CurrencyController to be my ProcessController.
Now take 5 of them, each to convert something else.
Now I want to make an additional controller that regulates these 5 "programs".
So the reason why is that I run these fie independent "units" in a 5 tab tabview.
Now I have one button called "New item", when I press this button, I want the "App controller" to find out which tabview is currently selected and than invoke a "new item" method in the proper "Process controller".
So the question is, is this the right approach, and how do I invoke this new item method in the right subcontroller. Again, as I set up the currency controller as a model for my Process units, the process controller is a simple subclass of NSObject.
Again, many thanks already, it's starts to become clear, but the oversight still lacks....
Alex
Is your ProcessController class a subclass of NSApplication, then? If
so, you should be able to say:
[[ProcessController sharedApplication] beepForMe];
John
On Thursday, June 20, 2002, at 03:03 PM, email@hidden wrote:
>
OK, I get that, but when the program runs, doesn't it create an
>
instance of the ProcessController class then?? Can't I target that
>
one?? I must be seriously missing an oversight here....
>
>
Alex
>
>
You're sending a message to the ProcessController class itself... the
>
way you have it set up, you need to send the message to an *instance*
>
of the ProcessController class.
>
>
John Anderson
>
>
>
On Thursday, June 20, 2002, at 02:24 PM, <email@hidden> wrote:
>
>
> Hello all,
>
>
>
> I've got one more big "I don't get it" block, which I'm afraid might
>
> be obvious for experienced programmers. So if you hate newbie
>
> questions, please skip this email, but anyone who has some time to
>
> help me overcome this problem, thanks a alot in advance!
>
>
>
> 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.