• 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
NSTextField value changes after tab-through
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTextField value changes after tab-through


  • Subject: NSTextField value changes after tab-through
  • From: "Matthew Stone" <email@hidden>
  • Date: Mon, 04 Jun 2007 15:43:56 -0500

Dearest Cocoa users,

I have an app with several NSTextFields (the single-line kind you can type in) that are initially set to an empty string (@""). Later in my program, I try to check whether or not the field is empty using the IF statement:

if( [textField stringValue] == @"" )
 // do something

This returns true on any fields that have not changed AND have not had the cursor placed on them, either by clicking on the field or by tabbing through them. I have tried checking if it's empty as I said above, plus:

if( [textField stringValue] == nil)
 // do something

if( [textField isEmpty] ) // this one crashes, just thought I'd eliminate it as a possibility
// do something


I noticed that there is a task of - textDidChange but that only lets me know if the text *changed* an not whether or not the field is still empty. I've also tried to NSLog() the strings before and after they've been tabbed-through and the output is the same. One of my thoughts was to output the ASCII values of the characters in the string, but I honestly don't know how nor could I figure out how (I'm no Cocoa expert).

So, does anyone know what, exactly, the string in the NSTextField is after tabbing through it? And if not, does anyone know how I can find out??

Thanks!
-M. Stone

_________________________________________________________________
Like puzzles? Play free games & earn great prizes. Play Clink now. http://club.live.com/clink.aspx?icid=clink_hotmailtextlink2


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSTextField value changes after tab-through
      • From: Daniel Staal <email@hidden>
    • Re: NSTextField value changes after tab-through
      • From: Yann Bizeul <email@hidden>
  • Prev by Date: Re: Question about NSArrayController
  • Next by Date: Re: NSURLDownload notifies on wrong thread?
  • Previous by thread: Re: Ligatures with appendBezierPathWithGlyph
  • Next by thread: Re: NSTextField value changes after tab-through
  • Index(es):
    • Date
    • Thread