|Dec 31, 2008, 12:18 PM||#1|
Testing an NSTextField objectValue for Data?
I'm working through the chapter 6 Hillegass (third edition) challenge where he asks you to make a "To Do" list. I have an NSTextField variable called "taskTextField". The user types a task in the NSTextField and clicks an "add" button which then enters the value in the table.
My question is this ... I don't want the user to simply push, "add" without typing anything in the NSTextField. I tried this to obtain that functionality:
if ( [taskTextField objectValue] != nil )
but that didn't cut it. When I clicked on "add" it entered the empty task into the table.
I got it to work by doing this:
if ( [[taskTextField stringValue] length] != 0 )
but it seems silly to have to it that way. How do I test for an 'empty' object? There has to be an easy way to do that ... ? Thanks.
"Government, even in its best state, is but a necessary evil; in its worst state, an intolerable one." -- Thomas Paine
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Best App for Data Usage Monitoring?||G5Unit||iPhone and iPod touch Apps||1||Jul 29, 2011 09:26 PM|
|Help Needed - Xcode 4 Options: Use Core Data Include Unit Tests||Mitch1984||iPhone/iPad Programming||3||Feb 26, 2011 04:42 PM|
|Image in an NSTextField||davbeck||Mac Programming||0||Jan 26, 2009 11:20 PM|
|Centering text from an NSAttributedString in an NSTextField [SOLVED]||Eraserhead||Mac Programming||1||Mar 10, 2008 07:02 PM|
|Testing an iPod for water damage [or other] before purchase||fenixx||iPod||5||Oct 18, 2006 04:57 AM|
All times are GMT -5. The time now is 03:03 PM.