Re: Undo group action name lost in drag operation
Re: Undo group action name lost in drag operation
- Subject: Re: Undo group action name lost in drag operation
- From: Jeff Gilbert <email@hidden>
- Date: Tue, 05 Oct 2004 09:17:59 -0500
Hi Gabriele,
One way to avoid the problem is to not have model objects set the action name. A good place to set the action name is from the IBAction method (triggered by a menu command, etc.) or some other method (drop method) that gets called directly from a user-generated event.
You can think of the action name as a UI-related feature and models should not really be concerned with UI.
Jeff Gilbert
On Tuesday, October 05, 2004, at 08:34AM, Gabriele de Simone <email@hidden> wrote:
>
Hi everyone,
>
>
In response to a copy-on-drop operation in a NSTableView, I add a
>
number of elements to my model. To my great pleasure I noticed that
>
whatever Cocoa class was processing the drag operation for me was
>
automatically beginning and ending an undo group around my handler
>
(tableView:acceptDrop:row:dropOperation:).
>
>
Enlightened by this discovery, I set an action name at the end of my
>
insertions ("Add Items"), and sure enough this action name shows up
>
under the Edit menu as "Undo Add Items". The problems begin when you
>
undo that operation. The action name is lost, and the Redo menu item
>
name takes the name of the last nested action of the undo group.
>
>
Now, I did find the following workaround, which basically tells my
>
model objects *not* to set the action name if an undo group is open...
>
>
if ([undoManager groupingLevel == 0) {
>
[undoManager setActionName:@"something"];
>
}
>
>
...but I am interested in knowing whether I am ignoring some basic
>
knowledge on undo grouping action names. A search for "undo group
>
action name lost" brought up nothing on CocoaBuilder.
>
>
Thanks,
>
Gabriele
>
>
_______________________________________________
>
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
>
>
_______________________________________________
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