views:

353

answers:

2

Hi All

How we set or get focus on any control in cocoa. like setfirstresponder

We have 2 control A and B, A is firstresponder After action I want to set focus ob B control

and also how we get focus on a particular control and how we notify that leave focus..... I need it in validation .... I want to force user to fill a textfield and then go to next field..something like this

Thanks Deepika

+3  A: 

You should use NSWindow’s makeFirstResponder: to change the current first responder. See the NSResponder class reference for details on this.

Ciarán Walsh
+1  A: 

For validation, the -becomeFirstResponder and -resignFirstResponder methods can be overridden.

More details in the documentation

Abizern