Re: sendAction:to:from: fails when application is in background
Re: sendAction:to:from: fails when application is in background
- Subject: Re: sendAction:to:from: fails when application is in background
- From: Bruce Truax <email@hidden>
- Date: Fri, 03 Nov 2006 19:52:53 -0500
- Thread-topic: sendAction:to:from: fails when application is in background
Thank you. That did the trick. I have been looking for a function that
would give me the receiving object's id for some time. This will help in
many places in my code.
As to why I am using the responder chain for in this way, it has to do with
the fact that I am parsing a file and passing the data to a separate thread
which is running asynchronously. The main controller handles receives and
sends the messages. Now that I have an easy way to get the pointer that
controller I can simply talk directly to it and I do not need to use the
responder chain.
Bruce
On 11/3/06 7:03 PM, "Erik Buck" <email@hidden> wrote:
> NSApplication sendAction:to:from: is using the responder chain to
> determine the receiver of the action. When there is no key or main
> window, the responder chain is very short and does not contain any
> objects that are in windows.
>
> NSApp is a synonym for [NSApplication sharedApplication] and it never
> changes within your program. There is no mysterious interprocess
> communication going on.
>
> Using the responder chain to send messages "while processing a large
> file" sounds like a very strange thing to do to me. What are you
> really trying to do ?
>
> Why don't you just get a pointer to the object to which you want to
> send messages and send the messages directly ?
>
> You could even use NSApplication's - (id)targetForAction:(SEL)
> aSelector to initially find the object to which you will send
> messages, but that method is presumably already being used by -
> sendAction:to:from: and won't work well with a short responder chain
> either.
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden