• 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: Undoable controls
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Undoable controls


  • Subject: Re: Undoable controls
  • From: Frode <email@hidden>
  • Date: Fri, 9 Sep 2005 07:14:50 +0200

Thanks moderator for giving me hints and points on new resources!

After looking at the FAQ I consider rephrasing my posting. :-)

2005-09-08 kl. 10.11 skrev Sherm Pendley:


My software needs undoable controls for NSControls, in particular for textfields (NSTextField, not NSTextView!) and checkboxes (NSButton).

That's not the usual way of thinking about it. Normally, undo is thought of as applying to your application's data - that is, the Model layer objects in an MVC design. The controls you're speaking of - the View layer - reflect the state of the data, and update themselves accordingly when they're notified of data changes.

In my implementation, checkboxes (NSButtons) are the actual model! :-) I don't have any special BOOL-field storing the current checkbox value; that's the checkboxes doing. If we compare text-fields or text-views, the view is normally the one storing application's data, too, in practice. Isn't it?


Now, my problem is that when the action is called, the NEW checkbox state is already set. And for mixed controls, there seems to be no method for determine the previous value from the action-callback.

I'm quite newbie to Cocoa Framework and after looking in Apple documentation and sample code, I can't find any issue dealing with this.

Of course, I could sub-class, introduce fields, etc. etc. but is there any easier - more smarter - way to do this? Is it possible to let the action-callback be called BEFORE the button respons to the mouse click? Or do you know any sample code dealing with this?

Thanks in advance!

Regards,
Roger

_______________________________________________
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


  • Follow-Ups:
    • Re: Undoable controls
      • From: "John C. Randolph" <email@hidden>
    • Re: Undoable controls
      • From: Chris Hanson <email@hidden>
References: 
 >Undoable controls (From: Frode <email@hidden>)
 >Re: Undoable controls (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Detecting memory leaks
  • Next by Date: Re: Contextual menu click in window title
  • Previous by thread: Re: Undoable controls
  • Next by thread: Re: Undoable controls
  • Index(es):
    • Date
    • Thread