NSFormatter problem when dialog box closed
NSFormatter problem when dialog box closed
- Subject: NSFormatter problem when dialog box closed
- From: John Nairn <email@hidden>
- Date: Thu, 11 Jul 2002 16:01:51 -0600
I have an NSFormatter on an NSTextField in a modal dialog sheet. It
works correctly as I tab around fields, but when I click OK, the dialog
sheet exits without verifying the format of the field. Thus I might end
with invalid text in the field.
I worked around the problem by checking the [myTextField objectValue]
when the OK button is clicked and giving an error message and keeping
the sheet up for it to be fixed if the entry is bad (a formatted cell
returns nil for objectValue if the format is wrong). But there are two
problems:
1. This objectValue check clears the field and the user has to re-enter
the entire data if there was a format error. It would be better to keep
the text and therefore only need to fix the error characters.
2. It seems rather klunky compared to other Cocoa tasks. Is there a
better way to have the format checked before OK proceeds to its action
procedure?
----------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.mse.utah.edu/~nairn
_______________________________________________
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.