1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Cocoa, getting focused control

Discussion in 'Mac Programming' started by NusuniAdmin, Oct 3, 2004.

  1. macrumors 6502a


    How would I go about getting the currently focused control? I mean there has to be some method I am missing that will return an identifier for the currently focused control.

    Also is there a method or something that is called each time a control gets focused and loses the focus.

    The reason I am asking is I want some specific things to happen when a control gets its focus and when it loses it.
  2. macrumors G3


    You can call the window's firstResponder to get a pointer to the object with that status. Is that what you mean?

    This article contains an example; see textObjectToSearchIn
  3. macrumors 6502a


    this may do what I want, thnx. I will try it out and see how it goes.
  4. macrumors 6502a


    hmm how come when resignFirstResponder i cannot edit the text in the text field?

    like [self setStringValue:mad:"bla"]; does nothing at all in the resignFirstResponder method.

Share This Page