Multiple Windows, Undo, and Bindings
Multiple Windows, Undo, and Bindings
- Subject: Multiple Windows, Undo, and Bindings
- From: "E. Wing" <email@hidden>
- Date: Mon, 18 Oct 2004 17:13:20 -0700
Hello,
I am trying to build a document based app which needs multiple windows
per document. It is a scientific oriented app so there a lot of
different windows used to setup different categories of parameters. In
addition, there are several other windows used to view the data in
different ways (some of which are OpenGL based).
So, first of all, I seem to need a good way of sharing data between
windows. For example, the OpenGL views need access to all the data in
order to display the information. But in addition, the parameter
windows also need to see each other's data because in some cases,
values must be validated against other parameters.
So, to start with, I've been looking at Malcolm Crawford's Cocoa
Bindings examples, particularly, the Graphics Bindings example. I've
been able to mimic its design and apply it to my stuff. However, I am
really stuck when trying to expand it into multiple windows and add
Undo.
So far, by placing more windows in the same nib file (I'm starting to
get the impression that I'm not supposed to do this though), I can do
communication through the bindings. However, when I try implementing
Undo, everything breaks down. It seems that only the first window I
created gets access to the Undo in the menu. But I can actually undo
other windows not in focus (but I can't undo them when those windows
are in focus), assuming I don't crash my program. Also, I have this
annoying side effect that my "MyDocument" class is becoming huge
because it stores all my data members and methods.
Going through the Cocoa documentation, I get the impression that I am
supposed to subclass NSWindowController to handle this, but I am
unclear how to do this, and am also unclear how I can separate my data
among the NSWindowControllers but still connect them through Bindings.
I have been unable to find any example code of how to do this.
So perhaps the simplest question to ask is, can somebody describe how
to modify Malcolm's Graphics Bindings example so it works with
multiple windows and undo?
Thank you,
Eric
_______________________________________________
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