Le 6 juil. 08 à 13:47, Mark Wales a écrit :

So the document instance changes I guess. Why would that happen and how can
I stop it?

Only your code could tell us why.

The MyDocument.m file is pretty long so I don't want to post it on here, and it links to other files too. So here's the full source code instead: http://www.think-yak.com/files/XCite_source.zip – if anyone wants to check it out for me then that would be hugely appreciated, but please don't spend too much time on it.

I'm afraid there isn't as much commenting as there should be and some of the code is appalling at the moment – i only started Cocoa two weeks ago, so I'm still learning some of the basics (I know, for example, that the copy and paste procedure does everything twice, which is horribly inefficient – working on it today).

It's a drag-and-drop bibliography program in case anyone is wondering, for BibTex/EndNote etc.

Thanks again,


You should not create a new instance of MyDocument in your xib file.

In a nib document
- "File owner" represents an existing object that is determine when you load your nib file (passed as argument when usign a window controller for example). - The First responder represents... the first responder (see Cocoa Event Handling Guide to now how what it mean) and it change every time.
- Application represents the shared instance of NSApplication.

Except this 3 special items, all other objects in your xib document represent new instance that will be created when you load your nib.

In the case of a document based application, by default, the File Owner represents the document instance that load the nib.

So, the solution is pretty simple. Delete the MyDocument object in your xib file, and bind all action, target and other that was targetting it to the 'File Owner'.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to