Multiple windows in a doc based app How-To
Multiple windows in a doc based app How-To
- Subject: Multiple windows in a doc based app How-To
- From: Joseph Jones <email@hidden>
- Date: Wed, 27 Feb 2002 20:17:54 -0800
Hi all,
Hopefully my email address issue is now fixed, so this should get
through. :-)
Warning: Newbie Cocoa/Obj-C developer in action.
I have a doc based app and I am trying to get multiple windows on a
single document working. I have a main window that live throughout the
life of the document. It has it's own derived NSWindowController and
works very well.
Question 1: What is the best way for the doc and controller to
communicate? Currently, I am attempting to implement a protocol to
alleviate the following issues: Circular includes between the controller
and the document and the fact that [self document] throws a compiler
warning if I try to call a method I implemented in my derived documnet
class.
My main window is a table view containing a listing of items in my
document. However, not all the data in my document is displayed there.
Each of my items has a note field that I wish to disply using a
secondary temporary window. This window will appear when you select a
menu item, and disappear when you select the set button (or the cancel
button).
Question 2: What is the best way for this window to get/set it's
data? I am planning in using the same protocol to get and set the
specific items note data. Whe the set or cancel button is selected,
appropriate methods in the protocol are called. However, what happens
when the user selects a new item from my table view? Obviously, one way
is have the main window talk to the document and tell it a new item was
selected, and then have the document tell teh other window to update
itself. Unfortunately, this requires adding to the protocol, which at
this point is starting to look VERY heavy considering how simple this
application really is. Should I use notifications instead?
Question 3: Should the temporary window be added to the
windowController list for the document? If so, should it be removed when
the user selects set/cancel on the temp window?
I've been reading all the docs concerning Doc based apps in Cocoa
(including the class docs) and can't seem to get a grip on what I need
to do here.
Thanx,
joe
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.