• 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: Newbie - which NSTextField is the cursor in?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie - which NSTextField is the cursor in?


  • Subject: Re: Newbie - which NSTextField is the cursor in?
  • From: Thomas Lachand-Robert <email@hidden>
  • Date: Mon, 18 Mar 2002 10:17:45 +0100

Le lundi 18 mars 2002, ` 08:31 , email@hidden a icrit :


I have an fairly straightforward MVC-type app with several NSTextFields,
one of which (we'll call it T) I'm toggling between
editable/non-editable states depending on the state of a check box. If
the cursor is in T when the check box gets unchecked, I first make T
uneditable and then I want to politely put the cursor in another field
for the user, but to do this I need to be able to find out which
NSTextField the cursor is in (I don't want to touch the cursor if it is
not in T). I've tried looking at [NSView focusView] but this returns
the check box that just got clicked, and [Window firstResponder] doesn't
seem to help either. I guess I could track it myself with a global by
adding notifiers to each NSTextField, but I suspect there is an easier
way that I'm missing. Any suggestions to help me on my way?

[window firstResponder] should be correct in theory. However, I think it might return the field editor for the textfield, not the textfield itself. I'm not sure offhand how to get from the field editor back to the original textfield.


You know whether there is a text field edited currently by checking if the first responder is a NSTextView and responds YES to isFieldEditor. If so, its delegate is the currently edited NSTextField.

Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
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: Newbie - which NSTextField is the cursor in?
      • From: email@hidden
References: 
 >Re: Newbie - which NSTextField is the cursor in? (From: email@hidden)

  • Prev by Date: NSTableView, NSButtonCell, NSSwithcButton
  • Next by Date: Re: Default Button Cells
  • Previous by thread: Re: Newbie - which NSTextField is the cursor in?
  • Next by thread: Re: Newbie - which NSTextField is the cursor in?
  • Index(es):
    • Date
    • Thread