Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / June 2005



Tip: Looking for answers? Try searching our database.

Please help with delegates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
zamiran - 27 Jun 2005 22:18 GMT
Hi,

I'm newbie to Cocoa. Could you help me with the following problem.
I'm trying to implement the delegate

[docPDF setDelegate :self]

If I try to make some changes on the object which is the owner of the
delegate it works.
But if I try to make some changes with another object of the same
type it fails unless I define it inside the delegate function.

So my question is how and where do I have to define an object in
order to be reachable from the delegate implementation.

Thanks a lot.

* posted via http://www.mymac.ws
* please report abuse to http://xinbox.com/mymac
Gregory Weston - 28 Jun 2005 12:03 GMT
> Hi,
>
[quoted text clipped - 10 lines]
> So my question is how and where do I have to define an object in
> order to be reachable from the delegate implementation.

My question is: What does your question mean? Can you describe in
greater detail what you're trying to do, and perhaps include some code
if appropriate? I'm really not sure what you're actually describing. It
sounds like you've got a delegate associated with an object that's
trying to do something to a different object of the same type as that
for which it's a delegate, but something's going wrong somehow (don't
know the actual failure behavior) and I'm not sure what it would mean to
"define it inside the delegate function." Are you perhaps trying to
manipulate an object that your delegate simply doesn't know exists?

Signature

Goal 2005: Convincing James Hetfield to cover the Strawberry Shortcake
"Are You Berry Berry Happy?" song.

zamiran - 28 Jun 2005 14:42 GMT
> My question is: What does your question mean?

Gregory Weston,

sorry for the unclearness. You are right I'm trying to manipulate an
object my delegate doesn't know exists. And I have no idea how to
deal with it. I'm truing to describe the object extrnally but it
doesn't work . Can you advice me something? here is the code:

- (IBAction)writePdf:(id)sender
{

//temp1PDF = [[[PDFDocument alloc] initWithURL:
//                        [NSURL fileURLWithPath:@"/volumes/macintosh
hd/PDFS/empty.pdf"]] autorelease];

NSString *search = @"3533168";
[docPDF setDelegate :self];
[docPDF beginFindString: search withOptions: NSCaseInsensitiveSearch];

}

- (void) didMatchString: (PDFSelection *) instance
{

selectPDF = instance;

// I have to describe this temp1PDF here and it is reset all the
times, but I need to have it acccumullate smth.
temp1PDF = [[[PDFDocument alloc] initWithURL:
[NSURL fileURLWithPath:@"/volumes/macintosh hd/PDFS/empty.pdf"]]
autorelease];

[temp1PDF insertPage: [docPDF pageAtIndex:0]   atIndex: 0];
[temp1PDF writeToFile:@"/volumes/macintosh hd/PDFS/results.pdf"];

++pp ;

}

* posted via http://www.mymac.ws
* please report abuse to http://xinbox.com/mymac
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.