bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings only working in one direction


From: Fred Kiefer
Subject: Re: Bindings only working in one direction
Date: Thu, 25 Jun 2009 09:29:41 +0200
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

Thank you for your investigation. This means we need to add the few
lines for binding handling from NSControl sendAction:to: in NSTextField
textShouldEndEditing:, but only for the case where the value actually
did change. What is the best way to compare the old value of the cell
with the new one from the editor?

But there is a worse problem. What to do with the binding handling in
NSControl? This seems to be completely wrong for text fields, but we
needed it here for buttons and comboboxes. Anybody an idea where we
could move this code to?


Andy Balholm wrote:
> In Cocoa, the action seems to be sent when the control loses focus or
> Enter is pressed, regardless of whether the value has actually changed.
> 
> In Interface Builder, I made a window with two text fields and a slider.
> Each text field's action is set to takeIntegerValueFrom: and its target
> is the slider. If I put 0 in one field and 100 in the other, the slider
> moves back and forth as I click on the two fields.
> 
> Updating the value for a binding, on the other hand, is called from
> -[NSTextField textShouldEndEditing:]. The value is updated only if the
> contents of the field have actually changed. I got the following stack
> trace by binding to a custom class whose setter always crashes:
> 
> #0    0x90e7abfa in _objc_error
> #1    0x90e7ac30 in __objc_error
> #2    0x90e79637 in _freedHandler
> #3    0x00001f7f in -[BadSetter setValue:] at BadSetter.m:24
> #4    0x909565f4 in _NSSetIntValueAndNotify
> #5    0x9089f257 in _NSSetUsingKeyValueSetter
> #6    0x9089ecee in -[NSObject(NSKeyValueCoding) setValue:forKey:]
> #7    0x909237c1 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
> #8    0x94828441 in -[NSBinder
> _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
> 
> #9    0x948281f2 in -[NSBinder setValue:forBinding:error:]
> #10    0x94827e8b in -[NSValueBinder
> _applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
> 
> #11    0x94827b19 in -[NSValueBinder
> applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
> 
> #12    0x9482a86e in -[NSValueBinder
> _applyDisplayedValueIfHasUncommittedChangesWithHandleErrors:typeOfAlert:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
> 
> #13    0x948273fa in -[NSValueBinder
> validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:]
> #14    0x948271b7 in -[_NSBindingAdaptor
> _validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:bindingAdaptor:]
> 
> #15    0x948270ef in -[_NSBindingAdaptor
> validateAndCommitValueInEditor:editingIsEnding:errorUserInterfaceHandled:]
> #16    0x946f9eb1 in -[NSTextField textShouldEndEditing:]
> #17    0x946f99ee in -[NSTextView(NSSharing) resignFirstResponder]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]