bugGNUstep - Bugs: bug #3346, NSDocument actions are not...

Group
 
 

bug #3346: NSDocument actions are not reachable

Submitter:  Stefan Urbanek <stefanu>
Submitted:  Sun 27 Apr 2003 08:06:42 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  nico
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 05 Oct 2006 05:37:13 PM UTC, comment #5: 

Marking as fixed, since it's closed and obviously working. :)

Gregory John Casamento <gcasa>
Group administrator
Mon 28 Apr 2003 12:21:32 PM UTC, comment #4: 

NSApplication -targetForAction: was not checking if the
keyWindow's NSDocument responded to the action.  Fixed on CVS.

Thanks for reporting the problem.

Nicola Pero <nico>
Group Member
Mon 28 Apr 2003 10:15:20 AM UTC, comment #3: 

No - the methods should be implemented only in NSDocument.
There is a precise reason for this - when you subclass
NSDocument, you might want to add new methods other than save/close.  Those methods should be immediately available
to the main menu without the need of wrapping them manually
in NSWindowController/NSDocumentController.

It fits in the general philosophy that actions of the active
objects are activated and can be called directly from the menu.  That makes simple to add new actions to objects which
can be active, and new menu items calling those actions without modifications of other parts of the software.

The problem you are having is definitely due to not setting
up correctly the various connections required in NSDocument-base applications.  Those connections are
confusing to set up; Apple seems to have targeted too much flexibility at the expense of simplicity.

Without source code of what you have done, it's difficult
to guess what needs changing, so I'll point you to examples
instead:

I'm not sure if Ink (gui-only version) is right - it's a while I don't look at it; but the Renaissance version
of Ink (included in the Renaissance example applications)
is definitely right and it works (on both GNUstep and
Apple OS X).

Renaissance also uses both a customized NSDocument and NSWindowController in order to support loading nib files
from .gsmarkup rather than .gorm; you might take that as
an example of using both customized.

Else, if you still can't figure out how to set up the
connections properly, please submit the code you are using.

Nicola Pero <nico>
Group Member
Mon 28 Apr 2003 07:12:04 AM UTC, comment #2: 

Yes, this is what was done in Ink.app , but it is not the right way. It does not make sense to have NSWindowController if you have to make document a delegate of a window. According to apple docs in "Document based applications: Window controllers and nib files" delegate of window does not have to be used or it can be set to the window controller.

Actually, those save* and close: methods have to be implemented in NSDocumentController (not in nswindow controller, because it does not have to be a delegate of the window) and forwarded to current active document. Attached is a patch for NSDocumentController. Ignore previous patch.

Stefan Urbanek <stefanu>
Group Member
Sun 27 Apr 2003 08:41:38 PM UTC, comment #1: 

The trick I found is that you have to set the NSDocument as the delegate of NSWindow. But It doesn't make sense if you have your own NSWindowController.
Anyway, just a comment.

-Deleted Account- <yjchen>
Sun 27 Apr 2003 08:06:42 PM UTC, original submission:  

NSDocument actions saveDocument:,  saveDocumentAs:, saveDocumentTo:, close: are not reachable from main menu. I have subclassed NSDocument and NSWindowController. I had to implement those methods in NSWindowController subclass and forward them  to NSWindowController's document. I think those methods should be implemented directly in NSWindowController. Patch is attached (except close:).

Stefan Urbanek <stefanu>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #413:  NSDocumentController.m.patch added by stefanu (1KiB - application/octet-stream)
file #409:  NSWindowController.m.patch added by stefanu (700B - application/octet-stream - added save* methods to NSWindowController)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

Follow 4 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2006-10-05 gcasa StatusNone Fixed
2003-04-28 nico Open/ClosedAnalyzed None
2003-04-28 nico Open/ClosedOpen None
2003-04-28 nico Assigned toNone None

Back to the top

Powered by Savane 3.13-02a9.
Corresponding source code