Re: IBoutlets out of scope in c functions?
Re: IBoutlets out of scope in c functions?
- Subject: Re: IBoutlets out of scope in c functions?
- From: Jonathon Mah <email@hidden>
- Date: Sat, 11 Mar 2006 00:22:46 +1030
Hi Mike,
On 2006-03-10, at 23:33, Mike Lehmann wrote:
I've had no problems getting all the connections to work, and am able
to see the messages generated by the c++ class, as well as convert the
generated info to an NSString. This NSString in turn is quite happy
to be displayed in an NSLog, but balks at being used in an NSTextView.
More specificly, if I try to pass a message to my "display screen"
(NSTextView), I am informed that the NSTextview is out of scope.
A C function is just that, a block of code not attached to anything
else. Your instance variable is attached to each Controller object.
So when you call printChatter() there is no way to know which
instance of Controller you want to use. You could add an object
variable to your function:
void printChatter(const void *controller, const string &inString)
{
id thisConversation = [controller conversation];
// ...
}
I don't have much experience with Objective-C++ at all, but a more
elegant way to do this may be to write a C++ wrapper for the
Controller methods you need. I'm sure someone else will be able to
let you know a better solution.
Jonathon Mah
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