I would like to receive additional information from the user during NSOpenPanel, but you need to check this information before completing the open panel. For example, I can let the user add a note about a file to an open panel, but I need to check that this comment is not empty.
I have an accessory whose controls are bound to NSObjectController, the content object of which, in turn, is bound to the presented NSViewController object, which I use to load the auxiliary nib view. The presented object has NSKeyValueCoding-complex verification methods (for example, -(BOOL)validateKey:error:). Validation is correctly processed (and violations are reported through a modal dialog) when the user changes the values ββof the controls.
My problem is that I canβt understand how to get confirmation if the user does not enter anything into the accessory. For example, let's say that I have one text field in an accessory whose related object checks that the text is not equal to zero in length. If the user enters text (verification completes successfully), then deletes the text, verification fails and the user is presented with an error. However, if the user does not enter text, the open panel is rejected without errors. How to check that the text is not equal to zero before the open panel is rejected?
source
share