Oops, missed the number formatter.. You are right.. number formatter is needed for the min/max values to show up. Which makes me thing that this is a mechanism that is a part of the number formatter.
Will dig around there. Will post a note if I find anything. bob. On Dec 17, 2011, at 2:43 PM, Peter wrote: > Thanks for the info! > I never realized that this is possible with object controllers. > > But wait a minute: While playing around with this mechanism, it turns out > that you have a number formatter installed on the text field for this to > work. I realized this when my app crashed after I had removed the number > formatter with the max value binding still in place! Removing the number > formatter made the min and max bindings as well as the discard?-dialogs > disappear obviously. > > Just tested this with the example project I referred to in my posting "Re: > responding to NSStepper clicks" of tonight: > Implementing the validateXXX method for your property XXX does not help at > all. > Sorry for pointing into the wrong direction. > I had hoped you might need to overwrite something in your object controller > subclass but there seems to be nothing. > > Here is a very old thread initiated by Matt Neuburg on cocoabuilder on the > issue: > > http://www.cocoabuilder.com/archive/cocoa/73532-who-is-putting-up-this-dialog.html > > And another posting on the issue: > > http://www.cocoabuilder.com/archive/cocoa/101845-using-validatevalue-forkey-error-to-limit-slider-range-with-cocoa-bindings.html > > I couldn't make any of these work though. > > And that's about all I could find - no answers really. > > Am 17.12.2011 um 20:17 schrieb Robert Monaghan: > >> The binding is straight forward.. >> >> You create an NSObjectController, and set the "Mode" to "Class" and the >> Class Name to your object with a bunch of NSNumbers. (prepared with >> @property/@synthesize, naturally) >> >> In my NSTextField, I bind my "value", "Min Value" and "Max Value" to the >> NSObjectController, specifying which NSNumbers are to be used for each. >> So I have have inside my object a set of NSNumbers called "maxVal" "minVal" >> and "currentVal", my NSTextField would reflect those values. >> >> If minVal is 10, maxValue is 20, and currentValue is 15. Everything is >> great. Now type in 500 in the NSTextField, and out pops a sheet! >> >> I am going to see about validation. Perhaps that is how this is happening. >> >> bob.. >> >> >> >> On Dec 17, 2011, at 11:10 AM, Peter wrote: >> >>> >>> Am 17.12.2011 um 19:59 schrieb Robert Monaghan: >>> >>>> Hi Everyone, >>>> >>>> Perhaps someone can help point me in the right direction on this: >>>> >>>> I have an NSObjectController that maintains a UI for me. >>>> I have an NSTextField which contains numerical value. You could type in a >>>> number, which populates an NSNumber object deep inside my code.. >>>> Magically, my NSObjectController does its thing and maintains the UI. Very >>>> cool stuff! >>>> >>>> I just recently updated my bindings for this NSTextField, so that a a Min >>>> and Max Value is respected. >>> >>> Interesting! How did you do that via bindings? >>> >>>> As a test, I typed a value which is outside the Min/Max value, to see what >>>> I need to implement. To my surprise, a sheet is created saying "The Value >>>> 500 is too large." It prompts the user to Discard or Keep Change. >>>> Where did this come from? And how do I override this? >>> >>> Implement a KVC validation method for your property. I guess. >>> See >>> file:///Library/Developer/Shared/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html#//apple_ref/doc/uid/20002173 >>> >>>> I can't find info in the docs. I do see a vague reference to a "sheet" in >>>> the NSObjectController Docs, with add/remove selectors, etc. But nothing >>>> concrete. >>>> Ideas? >>>> >>>> Thanks! >>>> >>>> bob. >>>> >>>> >>>> _______________________________________________ >>>> >>>> Cocoa-dev mailing list ([email protected]) >>>> >>>> Please do not post admin requests or moderator comments to the list. >>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>>> >>>> Help/Unsubscribe/Update your Subscription: >>>> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de >>>> >>>> This email sent to [email protected] >>>> >>> >> >> _______________________________________________ >> >> Cocoa-dev mailing list ([email protected]) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de >> >> This email sent to [email protected] >> > _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
