This is topic that I have grown to be very interested in in recent times.
How do most developers go about tracking their currentDocument in multidoc apps.
I am currently using draw's approach using mainWindow. (Note to scott, Im interested in seeing what people have to say about this) This assumes that you
have a window. I have the following problem with an app Im writing using this
approach.
I have a subview of my document window's contentView which condionally does an
NXHightlight rect in its drawSelf. The drawSelf is executed first when I send
my window makeKeyAndOrderFront. The thing it highlights is the currentDocument's currently highLightedroom.
Code follows.
- drawSelf:(NXRect *)rects :(int)count
{
Room *highlightedRoom;
/* erase update rect since the nximage might be smaller than our bounds */
OK, this is here so I can preserve the highlighting when I scroll the view aroun
d otherwise it would get completely redrawn and overwrite my highlighting. I as
sume you follow this.
Now, the problem occurs when I create a new document using new: since when its t
ime to send the window makeKeyAndOrderFront it will send my view a display the p
roblem is that the currentDocument at this time is still the old one. Thus I will get the same highlighted area from my previous document highlighted in my new one.
Hope this is clear. You see I need my window to appear in NXApps windowList bef
ore it sends a drawSelf. ???
What are the common uses of windowDidResignKey and windowDidResignMain when applied to apps that have global inspectors.