• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Inspector-aware undo in Doc-based app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Inspector-aware undo in Doc-based app


  • Subject: Re: Inspector-aware undo in Doc-based app
  • From: Raphael Sebbe <email@hidden>
  • Date: Fri, 4 Apr 2003 08:24:53 +0200

That works... Note that I use this as appropriate for my app:

- (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)aWindow
{
return [[[NSDocumentController sharedDocumentController]
currentDocument] undoManager];
}

Thanks !

Raphael


On Thursday, April 3, 2003, at 05:37 PM, Greg Titus wrote:

> Implement the NSWindow delegate method -windowWillReturnUndoManager:
> on the delegate of your inspector window. The implementation should
> look at the current document window's responder chain for the current
> undo manager and return that. Something like this:
>
> - (NSUndoManager *)windowWillReturnUndoManager:(NSWindow *)aWindow;
> {
> NSWindow *mainWindow;
> NSResponder *nextResponder;
> NSUndoManager *undoManager = nil;
>
> mainWindow = [NSApp mainWindow];
> nextResponder = [mainWindow firstResponder];
> if (nextResponder == nil)
> nextResponder = mainWindow;
>
> do {
> if ([nextResponder respondsToSelector:@selector(undoManager)])
> undoManager = [nextResponder undoManager];
> else if ([nextResponder
> respondsToSelector:@selector(delegate)] && [[(id)nextResponder
> delegate] respondsToSelector:@selector(undoManager)])
> undoManager = [[(id)nextResponder delegate] undoManager];
> nextResponder = [nextResponder nextResponder];
> } while (nextResponder && !undoManager);
>
> return undoManager;
> }
>
> Hope this helps,
> - Greg
>
> On Thursday, April 3, 2003, at 05:20 AM, Raphael Sebbe wrote:
>
>> I am not sure to understand. All undoable operations are implemented
>> on the model, as they should. My problem is about showing the undo
>> actions in the Edit menu, not record it.
>>
>> Raphael
>>
>> On Thursday, April 3, 2003, at 02:45 PM, j o a r wrote:
>>
>>> Implement all related undo methods in the inspector, and every time
>>> they are called, forward the request to the currently inspected >
>>> window.
>>>
>>> j o a r
>>>
>>> On Thursday, Apr 3, 2003, at 14:31 Europe/Stockholm, Raphael Sebbe
>>> wrote:
>>>
>>>> I have a doc-based app with a unique inspector (common to all
>>>> documents). Whenever I click on the inspector, the undo menu item
>>>> in Edit becomes gray, what I want is that it still applies to the
>>>> current document.
>>>>
>>>> Reading the doc, I thought of adding the current document to the
>>>> responder chain (as inspector panel's delegate) but it doesn't
>>>> work. Of course, this is a hack, yet it doesn't work.
>>>>
>>>> So my question, is there a neat way to do that ?
>> _______________________________________________
>> 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.
_______________________________________________
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.

References: 
 >Re: Inspector-aware undo in Doc-based app (From: Greg Titus <email@hidden>)

  • Prev by Date: Re: takeValue:forKey and BOOL
  • Next by Date: Re: NSStrings obtained from CFStrings
  • Previous by thread: Re: Inspector-aware undo in Doc-based app
  • Next by thread: NSMovieView Just Stops Playing
  • Index(es):
    • Date
    • Thread