Re: who is putting up this dialog?
Re: who is putting up this dialog?
- Subject: Re: who is putting up this dialog?
- From: Daryn <email@hidden>
- Date: Tue, 23 Dec 2003 20:33:24 -0600
On Dec 23, 2003, at 7:18 PM, matt neuburg wrote:
>
On Sat, 20 Dec 2003 17:59:56 -0500, Scott Anguish
>
<email@hidden> said:
>
> On Dec 20, 2003, at 11:09 AM, matt neuburg wrote:
>
>
>
>> The dialog, when I enter a non-number in this text field, reads:
>
>>
>
>> Alert
>
>>
>
>> Invalid number
>
>>
>
>> Buttons: Discard changes / OK
>
>>
>
>> The text field that causes this dialog has an NSNumberFormatter, and
>
>> it is
>
>> also bound thru an NSObjectController to an NSNumber value.
>
>>
>
>
>
> it should be the formatter, not the controller.
>
>
It may be the formatter, but that doesn't explain why the dialog does
>
NOT
>
appear when the text field has a formatter but has no binding. Clearly
>
the
>
binding is somehow participating in causing the dialog to appear; how?
>
Also,
>
recall from the original question that I also wish to know how to
>
customize or
>
prevent the dialog; is there a way? Or do bindings just take over
>
somehow and
>
force this dialog into existence, and it can't be prevented? Thx - m.
It's not the formatter. It's the controller and it's triggered by a KV
validation failure. Look at the stack trace when the dialog appears.
It should look something like this:
...
#12 0x92fe6f98 in NSRunAlertPanel
#13 0x931b5dec in -[NSBinder
_presentAlertWithError:fallbackMessage:allowDiscardEditing:
relatedToBinding:]
#14 0x931cad98 in -[_NSValueBinderPlugin
applyObjectValue:forBinding:operation:]
#15 0x931c24fc in -[NSValueBinder
_applyObjectValue:forBinding:handleErrors:]
#16 0x931c26dc in -[NSValueBinder applyDisplayedValueWithHandleErrors:]
#17 0x931c27f0 in -[NSValueBinder
_applyDisplayedValueIfHasUncommittedChangesWithHandleErrors:]
#18 0x931c2e48 in -[NSValueBinder
validateAndCommitValueInEditor:editingIsEnding:
errorUserInterfaceHandled:]
#19 0x931a96a4 in -[_NSBindingAdaptor
_validateAndCommitValueInEditor:editingIsEnding:
errorUserInterfaceHandled:bindingAdaptor:]
#20 0x931aac14 in -[_NSBindingAdaptor
validateAndCommitValueInEditor:editingIsEnding:
errorUserInterfaceHandled:]
#21 0x93108b34 in -[NSTableView textShouldEndEditing:]
...
Since none of that is documented, it's not possible to know how/where
to hook in to handle the validation error. I'm hoping that something
like control:didFailToValidateKeyPath:error: will eventually be added
to allow customization.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.