Setting a Control's Focus?

Discussion in 'Mac Programming' started by Fritzables, Jun 22, 2011.

  1. macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #1
    If I have an app with a number of controls within a window and want a certain control to have Focus when the application first runs - is this done by the First Responder in IB??

    Pete
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    In IB, you can drag a connection from your window to a control and select initialFirstResponder. You can do this programmatically via the setInitialFirstResponder: method as well.

    There's also makeFirstResponder: which is used at any time to set the focus on a control.
     
  3. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #3
    Just to clarify this is different to the First Responder object in IB. The First Responder placeholder object in IB is used to tie actions to whatever happens to be the First Repsonder at the time. For example, the copy menu item is tied to First Responder so that the copy message goes to whatever has focus at the time.
     
  4. thread starter macrumors regular

    Joined:
    May 6, 2011
    Location:
    Brisbane AUSTRALIA
    #4
    Thanks Jim,

    Yea, I was thinking the First Responder had the control to set focus on controls. You have set me right.... thanks again.

    kainjow.... Gee, that was easy..... :D

    Thanks for the help guys.

    Pete
     

Share This Page