Binding questions in a document-base application (Cocoa Recipes revisited)
Binding questions in a document-base application (Cocoa Recipes revisited)
- Subject: Binding questions in a document-base application (Cocoa Recipes revisited)
- From: Raff <email@hidden>
- Date: Sat, 12 Jun 2004 12:07:28 +0200
Hi !
I'm trying to make "Cocoa Recipes for Mac OS X" work with bindings.
Thanks to its very precise conception, this is an easy job !
However, I a several questions, for which I didn't find anything in the
mailing lists.
1. basic conception and undoManager -setActionName
a) By now, I just have a Document class (which is the File owner and
delegate of my main window) and several model classes (buttonModel,
sliderModel,).
I read in the documentation that undoManager method -setActionName
shouldn't be called in model methods, but I cannot see any other
solution yet.
Am I wrong ?
b) I made one ObjectController instance for each model class in PB. Is
it really a good idea, or is it better to put all the keys in one
ObjectController ?
2. target/action, delegation and classes
a) If I want to have target/action, I must implement these methods in a
controller class, in order to preserve the MVC design pattern, as for
the Beeper PullDownMenu.
I suppose I should not implement it in my Document class. I thought I
had to create Document categories, such as VRDocument
(VRButtonController), in order to manage delegation.
Am I wrong ?
b) I read I could bind my popdown menu items (beep once / beep twice)
to target methods, instead of using the target/action connections. Is
it really different ?
3. binding possibilities ?
a) I cannot see any mean to enable/disable a "back" and a "next" button
linked to a tabView, when we reach the first or the last tabs, from IB.
b) I cannot bind/connect a "low" and a "high" button to a slider in IB,
to set it to the min or max value.
I think I have to create action methods. As it may modify the model
date rather than the interface, maybe I could put it in the model class
??????
4. binding and reciprocity
If I have three two-state radio buttons and one other radio button with
mixedState allowed ("Select All"), and I'd like to see the "Select All"
button correspond to the state of the other buttons (NSOffState if none
is selected, NSOnState if all selected, NSMixedState in any other
condition). I may create a method similar to the -amountInOtherCurrency
method of the CurrencyConverter tutorial, which would determine the
value according to the other buttons, with a call to
+setKeys:triggerChangeNotificationsForDependentKey: in an +initialize
method.
However, in order to make it work, I have to bind the "Select All"
radio button to this method, which prevent me from changing the three
other buttons if we do click on the "Select All" button (it would call
my update method, instead of an action method).
In other words, is it possible to use bindings when the actions have no
reciprocity ? (click one of the 3 buttons > update "Select All"; click
"Select All" > change the state of the 3 buttons).
***
I hope that my english is not too bad, and that all these questions
will not bother you.
Thanks in advance for any answer !
Raff
_______________________________________________
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.