Re: Undoable controls
Re: Undoable controls
- Subject: Re: Undoable controls
- From: "John C. Randolph" <email@hidden>
- Date: Fri, 9 Sep 2005 00:38:58 -0700
On Sep 8, 2005, at 10:14 PM, Frode wrote:
In my implementation, checkboxes (NSButtons) are the actual model!
Don't do that.
:-) 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?
No. There's a class called NSTextStorage, that is created behind the
scenes.
Now, my problem is that when the action is called, the NEW checkbox
state is already set.
So, you need someplace to keep the values that are presented to the
user as a checkbox. That's what we call the "Model".
And for mixed controls, there seems to be no method for determine
the previous value from the action-callback.
That's right. Controls have no concept of a previous value. That's
a job for the model.
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.
Look for "Model-View-Controller" in the docs.
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?
Sample code that goes completely against the MVC paradigm? I hope not.
-jcr
John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.
_______________________________________________
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