Multi-window documents
Multi-window documents
- Subject: Multi-window documents
- From: <email@hidden>
- Date: Thu, 07 Oct 2004 05:17:24 -0700
Hi,
Apologies in advance, this will illustrate that I am completely lost at
this point, yet it must be pretty basic. I have gone through the
Hillegrass book (2nd ed), and looked through the Garfinkel book (though
not worked through yet), but don't understand. I have ordered the
Anguish book, but meanwhile...
I have a document-based app, which is to open a main window (which
contains a series of tabbed views). This document knows about a Project
MO, a list of Parties, and a list of Groups. I also have a menu item
which allows me to open Party and Group windows (each in its own nib)
so that I can create and edit these MOs, which need to be shared with
the main document. From what I have read, I need to write an NSWindow
controller which will own the MyDocument.nib (rather than MyDocument
itself, as I had originally), a NSWindowController to own each of the
sub windows, and possibly a controller each for each tab.
It seems hard to find good examples of this multi-document/multi-window
per document architecture. In MyDocument.m I have
- (void)makeWindowControllers
{
mainController = [[BandAidMainController alloc]
initWithWindowNibName: @"MyDocument"];
[mainController autorelease];
[self addWindowController:mainController];
[mainController showWindow:self];
partyController = [[PartyWindowController alloc]
initWithWindowNibName: @"Party"];
[partyController autorelease];
[partyController setParties:parties];
[self addWindowController:partyController];
groupController = [[GroupController alloc]
initWithWindowNibName:@"Groups"];
}
With the intention of opening the main window alone, and this
- (void)openPartyWindow:(id)sender
{
NSLog(@"open party window");
[partyController showWindow:self];
}
added to FirstResponder in MainMenu.nib, as the connection for the menu
item. The party window should operate directly on the list of parties
used by the main window (they are also displayed there). Problem 1 is
that I can't seem to get the list shared. Problem 2 is that both
windows open at the same time when I start the app, even though I don't
call showWindow: until the menu is called. Problem 3 is that the
'Party' menu item is not enabled unless the party window is displayed,
the opposite of what I want. In short, I am confused. My background is
Smalltalk, wxPython, and before that Think Pascal on Macs. IB is very
different from any GUI builder I have used, I just don't see how it
hangs together. None of the three books I have (I also have Learning
Cocoa) seem to give an example of adding menu items which are responded
to by documents rather than the app either, but I think I have worked
that out (adding to FirstResponder).
Many thanks in advance,
Alun ap Rhisiart
_______________________________________________
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