• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSFormatter problem when dialog box closed
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: Sheets using Cocoa/Java
  • Next by Date: Category list?
  • Previous by thread: Re: Sheets using Cocoa/Java
  • Next by thread: Re: NSFormatter problem when dialog box closed
  • Index(es):
    • Date
    • Thread