• 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: NSUndoManager & NSTableView editing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUndoManager & NSTableView editing


  • Subject: Re: NSUndoManager & NSTableView editing
  • From: Bill Cheeseman <email@hidden>
  • Date: Thu, 26 Sep 2002 06:28:42 -0400

on 02-09-26 1:42 AM, Pete Yandell at email@hidden wrote:

> A problem occurs when you do this: double click a row to edit it,
> change the text, then click the button to add a row. The edited row is
> changed and a new row is added, but the undo events for both these
> things are grouped together because they both occur within the one
> runloop. Choosing Undo in the Edit menu will then undo both in one
> hit, whereas they should be separate undo events.
>
> What's the recommended way for getting around this? Do I:
>
> ....
>
> d) perform some other magic trick that I haven't heard of? :)
>
> Anybody have any thoughts? Given that this should be a relatively
> common case to handle I'm hoping someone out there has worked out the
> right way to handle it!

I do it in an analogous row deletion scenario by calling NSControl's
abortEditing. In your situation, you should be able to call NSControl's
validateEditing. Or NSWindow's endEditingFor:. Or possibly NSCell's
endEditing:.

In Jaguar, any command that selects or deselects a row is supposed to do
this for you. So you might also be able to just deselect the row, either
with a specific command to do so, or [self window]makeFirstResponder:[self
window].

The idea is to force the row being edited to end editing gracefully (that
is, by validating its contents in case you have a formatter attached to it
or some other validation technique), before you add the new row.
--

Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com

The AppleScript Sourcebook - http://www.AppleScriptSourcebook.com
Vermont Recipes - http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont - http://members.valley.net/croquetvermont
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSUndoManager & NSTableView editing
      • From: Pete Yandell <email@hidden>
References: 
 >NSUndoManager & NSTableView editing (From: Pete Yandell <email@hidden>)

  • Prev by Date: Re: Pointer to static object member
  • Next by Date: Re: Switcher ( was Re: Book-OT )
  • Previous by thread: NSUndoManager & NSTableView editing
  • Next by thread: Re: NSUndoManager & NSTableView editing
  • Index(es):
    • Date
    • Thread