• 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
Re: NSTextField has cursor in it?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTextField has cursor in it?


  • Subject: Re: NSTextField has cursor in it?
  • From: j o a r <email@hidden>
  • Date: Fri, 5 Dec 2003 09:35:01 +0100

NSWindow has a "firstResponder" method that is suitable to use here.
How about something like this:

id firstResponder = [[self window] firstResponder];
id fieldEditor;
if ((firstResponder != myTextField) &&
(((fieldEditor = [myTextField currentEditor]) == nil) ||
(firstResponder != fieldEditor)))
{
NSLog(@"The text field doesn't have focus");
}

j o a r

On 2003-12-05, at 08.57, Louis C. Sacha wrote:

> How about the NSControl method:
>
> - (NSText *)currentEditor
> If the receiver is being edited -- that is, it has an NSText object
> acting as its field editor, and is the first responder of its NSWindow
> -- this method returns the NSText editor; otherwise, it returns nil.
>
> You could cycle through the NSTextFields, and the one that doesn't
> return nil is the one currently being edited... Don't know if there is
> a better option, and regarding the other response AFAIK there is no
> isFirstResponder method documented as of 10.2.

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSTextField has cursor in it?
      • From: Ed Watkeys <email@hidden>
References: 
 >Re: NSTextField has cursor in it? (From: "Louis C. Sacha" <email@hidden>)

  • Prev by Date: Re: NSTextField has cursor in it?
  • Next by Date: Problem with command-line installer vs. graphical
  • Previous by thread: Re: NSTextField has cursor in it?
  • Next by thread: Re: NSTextField has cursor in it?
  • Index(es):
    • Date
    • Thread