Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Ivang

macrumors newbie
Original poster
Sep 30, 2013
4
1
Hi, I have a window with 4 nstextfield, 2 added in xib and 2 added programmatically.
The focus change between the two added in xib with tab, but never change the focus to the 2 added programmatically.
In the link I added a very simple example for a better understanding.

https://www.dropbox.com/s/xsogsspfp1idc2j/Test.zip

I'm very beginner in OS X and I think the solution is really easy, but no idea how do it.

Thanx
Ivan
 
When the focus is in the NsTextField added in xib, I push the key TAB and the focus never is in the NSTextField added programmatically.

Thanx
 
I think what you need to do is use the method setNextResponder:

IE,

Code:
textField1.nextResponder = textField2;
 
I think what you need to do is use the method setNextResponder:

IE,

Code:
textField1.nextResponder = textField2;

I use this code:

Code:
NSTextField *campo1 = [[NSTextField alloc] initWithFrame:CGRectMake(30, 130, 100, 22)];
NSTextField *campo2 = [[NSTextField alloc] initWithFrame:CGRectMake(150, 130, 100, 22)];
[self.view addSubview:campo1];
[self.view addSubview:campo2];
campo1.nextResponder = campo2;

When the focus is in campo1, the focus don't change with the key TAB, I think this don't work.

Thanx.
 
Ok, all done.

nextResponder don't work for me, but nextKeyView, works perfect.

Thanx.
 
  • Like
Reactions: ivanicin
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.